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

StackOverflow https://stackoverflow.com/questions/10646216

Frage

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****
War es hilfreich?

Lösung

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

Andere Tipps

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)

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.

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.

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top