Lost connection to MySQL server during query
时间:2007-01-04 23:48:31 来源: 作者:whsong 点击:次 出处:技术无忧
Invalid SQL: UPDATE session SET lastactivity=1063798084,location='/showthread.php?s=&threadid=103' WHERE sessionhash='56609eb5e0df55682b957fbb5c5e4fac'
Originally Posted by eva2000
The most common reason for the MySQL server has gone away error
1. Is that the server timed out and closed the connection. By default, the server closes the connection after 8 hours or 28800 seconds if nothing has happened. You can change the time limit by setting the wait_timeout variable when you start mysqld via your server's /etc/my.cnf as well.
2. Another common reason to receive the MySQL server has gone away error is because you have issued a ``close'' on your MySQL connection and then tried to run a query on the closed connection. You can check that the MySQL hasn't died by executing mysqladmin version and examining the uptime.
i.e. to check mysql uptime, in shell as root user type:
mysqladmin -u root -p version
3. You can also get these errors if you send a query to the server that is incorrect or too large. If mysqld gets a packet that is too large or out of order, it assumes that something has gone wrong with the client and closes the connection. If you need big queries (for example, if you are working with big BLOB columns), you can increase the query limit by starting mysqld with the -O max_allowed_packet=# option (default 1M) or via max_allowed_packet variable in your /etc/my.cnf file and restarting mysql after you edited your /etc/my.cnf file. The extra memory is allocated on demand, so mysqld will use more memory only when you issue a big query or when mysqld must return a big result row
4. or simply your host restarted mysql.. i'd contact your web host