[Solved] : MySQL server has gone away – error while restoring the DB

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:


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


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

Post navigation

Arunlal Ashok

DevOps Engineer. Linux lover. Traveller.
Always happy for an open discussion! Write to arun ((@)) crybit ((dot)) com.

One thought on “[Solved] : MySQL server has gone away – error while restoring the DB

Leave a Reply

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