Thursday, March 13, 2008

"MySQL server has gone away" query error message with Drupal

For no obvious reason my Drupal administration site started showing this huge list of SQL queries with an error message "MySQL server has gone away query" followed by some arbitrary sql. After reading this I tried increasing the max. packet size to 24MB (sure sound huge!) and luckily all came back to life again.

Not sure what to do when you dont have access to this parameter though. It looks like drupal was trying to store really big chunks of data in a single query (I'm guessing cache-related). Perhaps there's a way to disable this which would in turn make the error go away?

1 comment:

sjusic said...

"MySQL server has gone away" (ERROR 2006) will happen if trying to restore a mysqldump which contains statements larger then your server's max. packet size. So I suppose its somewhat misleading to say that the error has anything to do with Drupal - its really a general MySQL thing.

By default, the size is set to 1MB it seems. Increasing it to 2MB seems to work on my end.