PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away:

Category: Note to Self

This error started to happen on a Drupal site I was developing on my development  machine (Fedora)

It’s apparently a problem with the ‘maximum allowed packets’ size in the Mysql configuration

To check the default value:

mysqladmin variables

Look at the value of max_allowed_packet, on my system the default is 1MB

SOLUTION

Increase to 100MB:

Edit mysql config error e.g  /etc/my.cfg and add  line:

max_allowed_packet=100M

then restart mysql

sudo service mysqld restart

Problem solved!

1 Comment

  1. Doncheks
    August 3, 2012

    Thanks man.It worked.You just saved the day.I had this problem while working on a local server but am not sure if it will come up again when I upload files to remote server.

Leave a Reply

You must be logged in to post a comment.