[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:

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

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

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 *