I'm trying to import a database in preparation for an upgrade from 5.0 to 5.5. The database isn't that large, only 37GB but I can't manage to import it without ERROR 2006. My most recent attempt when like this:

db01 # mysqldump -u root -p$password --databases $db --max_allowed_packet=2G --skip-extended-insert --add-drop-table  --force > /mydatabase.dmp

db02 # mysql --max_allowed_packet=2G -u root -p$password -e "source /mydatabase.dmp"
ERROR 2006 (HY000) at line 7292 in file: '/mydatabase.dmp': MySQL server has gone away

Here's my my.cnf:

innodb_buffer_pool_size = 3G
server-id = 4
log_bin = /var/lib/mysql/mysql-bin.log
binlog_do_db = my_database
port = 3306

# Disabling symbolic-links is recommended to prevent assorted security risks

# Recommended in standard MySQL setup


There is memory available on the server at the time - nothing else is running there. There's nothing in mysqld.log regarding this error. How can I get past this error?

  • Remove --max_allowed_packet=2G it's not needed for mysqldump.. --max_allowed_packet=2G is for direct queries not a sqldump. Feb 24, 2019 at 20:04

3 Answers 3


There is a misunderstanding on how large max_allowed_packet may be.

According to the following URL, the MAX is 1G.



ERROR 2006 (HY000) at line 7292 in file: '/mydatabase.dmp': MySQL server has gone away

Means that the connection got interrupted anormaly while the connection was on. There are many reasons why that can happen, one of the most common is that the server was killed during that.

There is not enough information on your post to say something in particular, what I can suggest is:

  • Please paste the error log around that time- you said no error was show, but please let us see that by ourselves. In particular, let us see your database server's uptime to confirm it.
  • Please paste the queries around 7292 line of that file, that may provide some extra information of which query fails exactly. You could skip lines until it works, and then analyze why those doesn't work
  • You could have file corruption, or some configuration that kills a specific query, or some imcompatibility between versions, or you forgot to run mysql_upgrade, ...
  • doing mysql -e "source" is a very convoluting way of doing an import- you could just:

    cat [or pv] /mydatabase.dmp | mysql ...
  • I added max_allowed_packet = 50M to my my.cnf and ran the import again. It completed without errors but took 3.5 hours.
    – Ken J
    Aug 15, 2017 at 0:10
  • @KenJ Glad you had a successful process. From MySQL command prompt, SELECT @@max_allowed_packet; will reveal your configured MAP and could be helpful in the future. You may have saved some wall clock time by using a larger value, up to the size of max_allowed_packet. Feb 25, 2019 at 13:41

For innodb_buffer_pool_size = 3G and max_allowed_packet=2G, I assume you have at least 8GB of RAM? If only 4GB, then cut those values in half. Otherwise swapping will slow things to a crawl.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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