“Lost connection to MySQL server during query”
If you don’t perform any query after creating connection to MySQL server, it may cause this problem.
The simple solution is to use mysql_ping PHP function to check the connection, if it’s lost, attempt to recreate it.
if (!mysql_ping($linkId)) {
mysql_close($linkId);
mysql_connect('host', 'username', 'password');
mysql_select_db('db_name');
// do your normal queries here
}