Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using the following command to import data from a 160 MB file created on another server with mysqldump. The environment I'm importing to is running the latest WAMP Server with max_allowed_packet set to "16M".

C:\wamp\bin\mysql\mysql5.1.36\bin>mysql --max_allowed_packet=15M -u root -pXXX drupal < C:\prod.sql

ERROR 2006 (HY000) at line 644: MySQL server has gone away

This seems to happen consistently after approximately 39 seconds and 85.5 MB imported.

I read many suggestions on increasing max_allowed_packet in my.ini, so I did to 16M rather than the default of 1M. Yet the error I'm receiving persists no matter what I do. Any ideas?

Now solved in my.ini:

[wampmysqld]
port        = 3306
socket      = /tmp/mysql.sock
key_buffer = 384M
max_allowed_packet = 100M
table_cache = 4096
sort_buffer_size = 2M
net_buffer_length = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 64M
myisam_sort_buffer_size = 64M
basedir=c:/wamp/bin/mysql/mysql5.1.36
log-error=c:/wamp/logs/mysql.log
datadir=c:/wamp/bin/mysql/mysql5.1.36/data
thread_cache_size = 8
query_cache_size = 32M

innodb_buffer_pool_size = 384M
innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 10M
innodb_log_buffer_size = 64M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 100

wait_timeout = 28800

[mysqldump]
quick
max_allowed_packet = 100M

[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
share|improve this question
    
Mattb: Did you get your data import working with the suggested answers? –  Richard Holloway Aug 14 '10 at 14:49
    
I did, thanks. The solution involved incrementing quite a few values in my.ini. Will post additional information shortly and accept. –  MattB Aug 16 '10 at 16:50

3 Answers 3

up vote 3 down vote accepted

What is the data structure in the sql?

It is possible one column is a blob, perhaps an image or PDF that is larger than 16M. Why not set the max_allowed_packet to 160MB (as no one packet can be bigger than the entire file size) and test it again, you can always switch it back later.

You can get a more accurate value if you get the data imported use the SHOW TABLE STATUS command to get the data sizes and you will then see how large it should be.

The error however is very general and there are a list of possible reasons you see the error on the mysql website

You will have to work through each one to locate the problem but in my experience it has always been a packet too big. I have max_packet_size set to 180MB on one of my production boxes for this very reason.

share|improve this answer

try to up the wait_timeout to like 100 in your my.cnf then restart the server

wait_timeout = 100
share|improve this answer
    
I think the default time out is 8 hours. –  Richard Holloway Aug 5 '10 at 22:29
    
14400, 4 hours. –  Warner Aug 6 '10 at 13:28

While Richard's answer is the common solution, check your .err log. It's possible MySQL is running out of memory and restarting. I've also had this recently happen with failing hardware.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.