MySQL MySQL lost connection to server during query problem resolution
Reason: In the query MySQL database, or modify the larger table when this situation occurs;
Google's:
Programme 1. Add a row of settings skip-name-resolve under the MySQL profile [MYSLQD]. The MySQL service needs to be restarted.
Programme 2 Add: IP and Host name Mapping relationship, such as: 127.0.0.1 localhost, in the Hosts file. This approach does not need to restart the MySQL service.
---------------------------
address this problem at three levels:
1. At the code level, you need to add roughly the following code to your PHP database connection.
if (In_array (Mysql_errno (), Array (2006, 2013)) {
mysql_close ();
Mysql_connect (...);
mysql_query (...);
}
In other words, encounter 2006,2013 error to reconnect to MySQL.
2. mysql level, you need to configure some parameters my.cnf (but here is Linux, what about my Windows configuration?) )
Wait_timeout = x Timeout time like 600 seconds
Max_allowed_packet = y Maximum allowable amount of data
Increase the X,y value appropriately.
3. Generally this situation is not all sample sentences but a single table, please fix the table before you can generally solve such problems.
----------------------
MySQL Error 2013:lost connection to MySQL server during query
Error code: 1153-got A packet bigger than ' Max_allowed_packet ' bytes
Workaround:
Modified Mysql.ini (online is said to be this file, looking for a long time to finally know where, my directory is in D:\MySQL_Data\MySQL Server 5.5 under the Mysql_data folder) file add the following code can
max_allowed_packet=500m
Modify F:\program\mysql5.0\my-huge.ini if you can't.
max_allowed_packet=16m 16 to 500/////////////I solved it by this method 2014-6-4 19:58//////////
The personal understanding is that the MySQL configuration provided by the maximum allowable memory to be large, after all, 16M may not be enough
I did it according to the method, try it.
----------------------
4. Can be set directly in MySQL:
#show variables like '%timeout% ';
#show variables like ' max_allowed_packet '
Set global wait_timeout=60000;
#set Global max_allowed_packet = 2*1024*1024