SoCkEt7
SoCkEt7

Reputation: 2277

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

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****

Upvotes: 20

Views: 44801

Answers (6)

Udhav Sarvaiya
Udhav Sarvaiya

Reputation: 10071

I am getting same error when import SQL file:

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

I have solved by using this solution:

First of all, stop the XAMPP/Wamp and then kindly open this file xampp\mysql\bin\my.ini

Increase size as per your requirement

max_allowed_packet=60M

And then restart your XAMPP/Wamp.

NOTE: For Windows, you can find the file in the C:\xampp\mysql\bin\my.ini Folder (Windows) or in the etc-Folder (within the xampp-Folder).

Very important Note: "Close your Command Prompt And Restart Again" (It's very important because if you didn't restart your command prompt then changes will not be reflected.)

Upvotes: 0

Adrian Cornish
Adrian Cornish

Reputation: 23868

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

Upvotes: 28

xManh
xManh

Reputation: 67

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.

Upvotes: 0

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.

Upvotes: 0

nightcoder
nightcoder

Reputation: 13509

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.

Upvotes: 2

bakytn
bakytn

Reputation: 364

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)

Upvotes: 14

Related Questions