Why I get “MySQL error: mysql server has gone away” error during restore ?

During the restoring from backup process I keep getting the error: MySQL error: mysql server has gone away. What do I do?

There are 2 main causes and solutions for “MySQL server has gone away (error 2006)”.

1) Server timed out and closed the connection.

To fix it, check if that wait_timeout mysql variable in your my.cnf configuration file is large enough.

2) Server dropped an incorrect or too large packet. If mysql gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and that is why it closes the connection.

To fix the problem, you can increase the maximum packet size limit max_allowed_packet in ‘my.cnf’ file, eg. set max_allowed_packet = 128M,

After that restart your MySQL server: sudo /etc/init.d/mysql restart

PS:
my.cnf file – is a configuration file of MySQL database server on your web hosting.

Leave a Reply

Your email address will not be published. Required fields are marked *

code