First analyze the problem:

The MySQL Server has Gone Away error occurs when the SQL file is imported in Navicat.

The solutions are as follows:

Open Tools in the Navicat menu, select Server Monitor, then select database in the left column, select variable in the right column, find max_allowed_packet, increase its value, and save.

After the change, import the backup SQL file again, everything is normal.

If you still can’t solve the problem, you can modify the mysql configuration file, find the mysql_my.ini configuration file in the mysql directory, and add the following code:

max_allowed_packet=500M

wait_timeout=288000

interactive_timeout = 288000

Change the values as needed, and finally remember to restart the mysql service.

Max_allowed_packet is the maximum packet allowed by mysql, that is, the request you send; Wait_timeout is the maximum time to wait. You can customize this value, but if the time is too short, the MySQL server has Gone away #2006 error will occur. The max_allowed_packet parameter controls the maximum length of its communication buffer. If you do not have the permission to modify myQL, you can do it in PHP program. If it is inconvenient to modify php.ini, you can try the following code to solve the problem.

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 fit the expectations.

More Internet information to pay attention to the blue team cloud wechat public number, enjoy cloud welfare oh