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

Today 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:
[Solved]1045 Cannot log in to the MySQL server : PhpMyAdmin error
Databases showing 0MB in cPanel

Arunlal Ashok

DevOps (Server & Cloud infrastructure) Engineer. I'm managing Linux servers since 2012. I started this blog to share and discuss my ideas. Any questions? Write to arun (@) crybit.com

You may also like...

Leave a Reply

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