mysql导入sql文件报错 ERROR 2013 2006 2002

时间:2022-02-12 06:02:26

今天导入sql总是提示错误

 

复制代码 代码如下:

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/mysql.sock' (111)
ERROR:
Can't connect to the server

 

网上试了很久,各种修改my.cnf,最后发现有人说是insert语句一次插入太多行造成的,解决办法就是每次insert一行

用mysqldump导出 加上参数--skip-extended-insert

不清楚是不是跟mysql版本有关,我的版本是
mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1

总算是解决了问题,虽然还没闹明白为什么会有这种现象出现,大家有知道的还请告之一下,不胜感激