欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

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

程序员文章站 2022-03-27 22:17:36
...

今天导入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 s

今天导入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

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