Mysql has gone away!

  • Filter
  • Time
  • Show
Clear All
new posts

    Mysql has gone away!

    While restoring a database on the server via root we might get below error:

    Mysql has gone away!

    Now looking at the error at once we may feel that the Mysql is been stopped or not working but when checking the Mysql status we see that the Mysql service is running.. weird!!

    Generally the issue arrise when your database backup is huge i.e above 100 MB or 150 MB, now to solve the issue just use below command to restore the mysql database:

    mysql --max_allowed_packet=500m Database_Name < Database.sql

    Now you will see that no errors and nothing the database will be getting restored with ease!

    Now if the server is a dedicated or VPS server Just edit folloiwng file:

    vi /etc/mysql/my.cnf

    and put max_allowed_packet = 200MB

    And resrat the mysql service by

    /etc/init.d/mysql restart