MySQL Server Has Gone Away Error - Cause & Solution

The MySQL Server has gone away error can happen when trying to restore a database. There are a few possible causes for this and one of the most likely is that the database is very big in size and the packet size in MySQL is not big enough.

The solution is to increase is the packet size in the my.ini file. The default is 1Mb. Change it to something like 24M.

[mysqld]
max_allowed_packet=24M

If you do not have access to the my.ini file, then you will need to contact your host.

If you are restoring a database locally using WampServer or similar, you can easily access the my.ini file. Just click on the WampServer icon on the toolbar, navigate to MySQL and then my.ini. The my.ini file will open as a notepad file. If max_allowed_packet does not exist, then add it after [mysqld]. Do not forget to save the file!

When you change (or add) the max_allowed_packet, you will need to restart MySQL in order for the changes to take affect.

Post new comment

The content of this field is kept private and will not be shown publicly.

Learn how to become a Drupal developer

Does Drupal development make your head explode and drive you crazy?

Why not learn from someone who has paved the way instead?

Sign up to my upcoming learning series.

Syndicate

Syndicate content

Hello!!

I am Blair Wadman and this is where I write about Drupal, PHP, CSS etc

Stuff

© Blair Wadman
2005 - 2011