MySQL has gone away / Lost connection to server during query

MySQL has gone away and Lost connection to server during query errors are commonly caused by the database server timing out or closing its connection before the page has fully loaded. This error can also be caused by certain queries on MySQL versions from before 5.0.21.

To resolve the problem you may need to increase the values of the MySQL wait_timeout and connect_timeout settings. These values are displayed in seconds, and are usually set to 28800 by default. They can be changed in your mysql.ini or my.cnf file (depending on the server's operating system). Once changed, you should restart MySQL.

Those using shared hosting services may not be able to change these settings themselves, and should contact their hosts to do it for them.

For more information please see the MySQL Documentation for this error.