A
A
Andrey Mavlyanov2012-09-25 17:28:33
MySQL
Andrey Mavlyanov, 2012-09-25 17:28:33

MySQL: server has gone away when importing sql dump

MySQL: server has gone away. How to deal with this in Windows? Gets out during the operation mysql -u user -p db < dump.sql (300 meters). On *nix on the same version of mysql there is no problem.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
ServDev, 2012-09-25
@ServDev

Try changing max_allowed_packet in MySQL config

K
Kirill Sidorov, 2012-09-25
@cyberia

InnoDB?

L
lubezniy, 2012-09-27
@lubezniy

This problem arises if the dump is done with the extended-insert option, when it is written in the style:
INSERT INTO ttable VALUES (1,'2','3'),(2,'2','4'),(4, '5','1');
There can be complete sets of values. As far as I noticed, such requests are processed only as a whole, and for this the client needs to read the entire request at once. If there are a lot of values ​​​​(I encountered on tables with hundreds of thousands of records), then the task rests either on exceeding max_allowed_packet (a message is issued about this), or on a lack of allocated RAM (in this case, the server crashes along with the process).
To avoid such situations, I prefer to dump with disabled --extended-insert, when there is one set of values ​​per INSERT query. The dump size naturally increases, but it can be processed without such problems.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question