Home > OS >  Excuse me, how to solve the lost connection to mysql server during query problem?
Excuse me, how to solve the lost connection to mysql server during query problem?

Time:10-08



Write a procedure, and then run, the data quantity is large, running to the 600 s pop up every time the reminder,

Excuse me, how to extend its operating time, thank you!

The novice small white)

CodePudding user response:

Try this
Google:
Scheme 1. Under the mysql configuration file [myslqd] add a line to set the skip - name - resolve. Need to restart the mysql service.

Scheme 2. In the hosts file to add: IP and host name mapping relationship, such as: 127.0.0.1 localhost. This way without restarting mysql service.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
On three levels to solve this problem:
1. The code level, you need to increase roughly the following code in your PHP database connection,
If (in_array (mysql_errno (), array (2006, 2013))) {
Mysql_close ();
The mysql_connect (... );
Mysql_query (... );
}
2006201 error message that is to say, you can reconnect it MySQL,
2. MySQL level, my need to configure some parameters. The CNF (but this is under Linux, my Windows configuration?)
Wait_timeout=x timeout time such as 600 s
Max_allowed_packet=y maximum allowable amount of data
Appropriate increase in x, y,
3. Generally appear this kind of circumstance is not all but a single table, would you please repair the table first generally can 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
The solution:
Modify mysql. Ini (say is this file online, looking for the N long finally know where my directory is D: \ MySQL_Data \ mysql Server 5.5) under MySQL_Data folder file add the following code
Max_allowed_packet=500 m

If can not change D:/MySQL/MySQL Server 5.5 \ my - huge ini
The max_allowed_packet=16 m in 16 to 500
I made according to this method, try
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
4. Can be set directly in mysql:
# show variables like '% % timeout';
# show variables like 'max_allowed_packet'
The set global wait_timeout=60000;
# set global max_allowed_packet=2 * 1024 * 1024
  • Related