MySQL server has gone away – MySQL restore error

You may receive the following error while restoring your MySQL database:

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

In most cases this error occurs due to max_allowed_packet limit. The default limit for max_allowed_packet is 1 MB which is not sufficient. If it requires more packet size during the restore, you will receive the above error.

To resolve this error, you need to edit your MySQL configuration file (my.cnf or my.ini) to raise the limit for max_allowed_packet. Add this in [mysqld] section as follow:


max_allowed_packet = 32M

After making the changes, restart your MySQL service.

Kailash Aghera

Leave a Reply