4

I'm piping mysqldump output trough perl -pane 's{(VALUES |\),)\(}{$1\n (}smg', so each insert row is on new line, like so:

INSERT INTO (col1, col2, ...) VALUES
  (value1, value2, ...),
  (value1, value2, ...),
  ...

But when i try to import this file, then those newlines and spaces produce MySQL has gone away error, because packet is too large.

Can i tell mysqldump how many rows(or bytes) to dump per insert?

Kristian
  • 3,283
  • 3
  • 28
  • 52
  • can you change mysql server options to set a larget packet size or longer timeouts, or this has to be accomplished by modifying the dump? – golimar Apr 15 '13 at 08:44
  • No, i cant change them. I could live without that formatting, but i just hoped that it could be accomplished. – Kristian Apr 15 '13 at 09:02

2 Answers2

1

You might like this one, it adds insert into for each row:

mysqldump --extended-insert=FALSE

Source: MySQLDump one INSERT statement for each data row

Community
  • 1
  • 1
Ramon Fincken
  • 253
  • 1
  • 5
  • 11
-2

Use the where option:

mysqldump --opt --where="1 limit 100" myDb
punKonsole
  • 17
  • 2