Importing 1GO SQL File => ERROR 2013 (HY000) at line 23: Lost connection to MySQL server during query

我是研究僧i 提交于 2019-12-04 10:13:40

问题


Ive got to import 1go of sql data, i raised up the max_allowed_packet to 1100M to be sure.

So i use :

My query

mysql -u root -p -D mainbase < GeoPC_WO.sql

But 1 minute later it stops during the process and i get this error :

**ERROR 2013 (HY000) at line 23: Lost connection to MySQL server during query
**Lost connection to MySQL server during query****

回答1:


Possible that you have some large insert statements that are bigger than you max size. Check your /etc/mysql/my.cnf file or wherever it is. Cannot remember what the default is - but setting it to something large like below may help.

This is one option

[mysqld]
max_allowed_packet = 16M

And maybe the other way

[mysqldump]
max_allowed_packet = 16M



回答2:


I had exactly the same problem. After 1 hour of struggling I resolved this by setting

net_write_timeout

to a higher value (in my situation it's 300)




回答3:


In my case the problem ("Lost connection to MySQL Server during query") was in a corrupted dump file or in the misbehaving HDDs:

First, I made a dump on the main server and then copied that dump to the replication server. But it seems the replication server had some problems with its HDDs and the dump became corrupted, i.e. MD5 of the original dump file on the main server was different from MD5 of the dump copy on the replication server.




回答4:


You can try with this:

First:

sudo /etc/init.d/mysql stop 

Then you should edit this file:

sudo vi /etc/mysql/my.cnf

Add the following line to the [mysqld] section:

innodb_force_recovery = 4

Finally:

sudo /etc/init.d/mysql start 

(innodb_force_recovery force the InnoDB storage engine to start. The value 4 mean your data files can be corrupted. For more information you can visit: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html)

Greetings.




回答5:


In my case it was because of the lack of RAM, I tried to import a 90MB zipped sql file to a 1GB RAM vps server and the error 2013 keep occured until I switched down the httpd service to release some memory and run the import command again and it was successful then.



来源:https://stackoverflow.com/questions/10646216/importing-1go-sql-file-error-2013-hy000-at-line-23-lost-connection-to-mysq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!