Thursday, 25 October 2018

MySQLDump one INSERT statement for each data row

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!

 Answers


Use:
mysqldump --extended-insert=FALSE 
Be aware that multiple inserts will be slower than one big insert.

0 comments:

Post a Comment