Managing MySQL server is one of the interesting thing for every sys admins.

In this article I’m just sharing a quick fix for the error that I got while restoring the database from its backup file. I hope this will be helpful for you guys too.

I got one error  while restoring the database backup file from the command line. Error message is shown below:

Error

# mysql database_name < database_back.sql
--------
at line 4511: MySQL server has gone away.
--------  

Solution

Check the value for the mysql directive “max_allowed_packet” in mysql configuration file “my.cnf”. Increase the value to higher to avoid the error.

# vi /etc/my.cnf
--------
max_allowed_packet=64M    #try higher values if problem persist.    
--------

Click here for cPanel conf details.

Then restart the mysql daemon.

# service mysql restart

After restarting the mysql service try again to restore the DB backup.

That’s it!!! 🙂

Related errors

MySQL tweaking – best practices and tips for SysAdmin