MySQLDump one INSERT statement for each data row

rexford picture rexford · Sep 15, 2012 · Viewed 112.5k times · Source

with the following statement:

mysqldump --complete-insert --lock-all-tables --no-create-db 
--no-create-info --extended-insert --password=XXX -u XXX 
--dump-date yyy > yyy_dataOnly.sql

I get INSERT statements like the following:

INSERT INTO `table` VALUES (1,'something'),(2,'anything'),(3,'everything');

What I need in my case is something like this:

INSERT INTO `table` VALUES (1,'something');
INSERT INTO `table` VALUES (2,'anything');
INSERT INTO `table` VALUES (3,'everything');

Is there a way to tell "mysqldump" to create a new INSERT statement for each row? Thanks for your help!

Answer

driis picture driis · Sep 15, 2012

Use:

mysqldump --extended-insert=FALSE 

Be aware that multiple inserts will be slower than one big insert.