Fix MySQL: Uncaught exception, MySQL server has gone away

MySQLFor a recent Drupal 7 project, I had to import a large database into XAMPP. There was a particular string that was very, very long and would trigger the following MySQL error: Uncaught exception, MySQL server has gone away

The solution is easy. Go to your XAMPP folder or whatever folder your setup is in -> mysql -> bin -> my.ini

Locate the [mysqld] section and modify (or add if missing) the following for max_allowed_packet:

max_allowed_packet = 100M

You should repeat this step for the [mysqldump] section as well, changing 100M to whatever value you wish, as 100M could be overkill for you.

Note that this isn’t specific to a XAMPP setup. It will work on WAMP and MAMP too or any setup involving MySQL (for the most part).

Leave a Reply

Your email address will not be published.