An error is always prompted when importing SQL statements today.
The code is as follows:
ERROR 2013 (HY000): Lost connection to MySQL server during query
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql. sock' (111)
ERROR:
Can't connect to the server
Solution 1
Use mysqldump to export and add the parameter -- skip-extended-insert
Solution 2
If the problem persists, let's take a look at the following:
Find the my. ini configuration file in your mysql directory and add the following code:
Max_allowed_packet = 500 M
Wait_timeout = 288000
Interactive_timeout = 288000
I can change the value based on the actual situation. I will directly change the value to a large value and remember to restart your mysql service.
In this way, the MySQL server has gone away problem can be effectively solved. In fact, it is caused by a large amount of data. Method 2 can also solve this problem.