I’m trying to move a database from serverA to serverB. I’ve created a mysql dump using the following command:
mysqldump -u root -p -c --add-drop-table --add-locks --quick --lock-tables mydatabase > /var/log/mydatabaseJan31.sql
Then on serverB, I’m trying to import this data by doing the following:
mysql -u root -p mydatabase < /tmp/mydatabaseJan31.sql
I’m getting the error “ERROR 2006 (HY000) at line 408: MySQL server has gone away” almost immediately.
I’ve read other posts on stackoverflow about the same error message and I have tried the following:
-
modified my.cnf to include:
[mysqldump]
quick
max_allowed_packet = 64M
Then i restarted mysql. By the way, the file size is actually only 5.2mb
- tried creating the dump file using phpmyadmin.
- I don’t think it’s a timeout issue because it dies 2 seconds into the import process.
-
I’ve opened the mysql dump file and checked out the line number it’s bombing on, and it’s a part of a massive insert statement that starts on line 43.
I’m not sure if it’s relevant, but line 406 starts off with an incomplete string:line 402—-> (341,1996,12,’
line 403—->front’),(341,1996,12,’interior’),(341,1996,12,’rear’),(341,1996,13,’front’),(341,1996,13,’interior’),(341,1996,13,’rear’),(341,1996,14,’front’)
but having said that, all the preceding records that are being inserted look the same way… so I don’t think that’s the problem either.
Any suggestions would be appreciated.
max_allowed_packetneeds to be set on both client (mysql) and server (mysqld) to have any effect. Since your problem happens when processing the dump, setting it for mysqldump will have no effect.