Reprint Link: http://www.111cn.net/database/mysql/64073.htm
MySQL database appears MySQL server has gone away error is generally caused by the SQL statement is too large, the following in the operation of the database using Navicat prompt MySQL server has gone away problem resolution.
When backing up data, the resulting SQL file is larger, and of course, this SQL contains much more redundant data. With Navicat direct import words, error MySQL server has gone away. As shown in the following:
Solutions
Open Tools in the Navicat menu, select Server Monitor, then select the database in the left column, click the variable form item in the right column, look for Max_allowed_packet, and change its value to large.
After the change, import the backup SQL file again, everything is OK.
If still unable to resolve, below I tidy up some MySQL query encountered MySQL server has gone away problem
Locate the My.ini configuration file in your MySQL directory and add the following code:
max_allowed_packet=500m
wait_timeout=288000
Interactive_timeout = 288000
I see the situation change the value, I directly changed a lot, finally remember to restart your MySQL service
This will be a good solution to the MySQL server has gone away problem. Max_allowed_packet is MySQL allows the largest packet, that is, you send the request, Wait_timeout is the longest time to wait, this value can be customized, but if the time is too short, after the timeout will be now MySQL server has gone Away #2006错误. The function of the Max_allowed_packet parameter is to control the maximum length of its communication buffer
If you do not modify the MYQL permissions we can in the PHP program, if the php.ini is not convenient to modify, you can try to solve the following code.
Ini_set (' Mysql.connect_timeout ', 300);
Ini_set (' Default_socket_timeout ', 300);
After Ini_set, you can use Ini_get to verify that the parameter settings are appropriate for your expectations.
Navicat MySQL server has gone away error what to do "reprint"