Francis Lewis
Francis Lewis

Reputation: 8980

How do I get full syntax in sql dump?

I'm trying to make a backup of a database, but for versioning purposes, I would like complete insert statements, like this:

INSERT INTO `table_name` (`id`, `type`) VALUES (1, 2);
INSERT INTO `table_name` (`id`, `type`) VALUES (2, 2);

Instead of the default:

INSERT INTO `table_name` (`id`, `type`) VALUES (1, 2), (2, 2);

My main reason for doing this is that it will put all the insert values on their own lines instead of on a single line for an entire table.

I tried adding the --complete-inserts and --extended-inserts in various formats, (one and both at the same time) and so far, I haven't seen any change in the resulting sql file from the mysqldump.

Here is my query, using complete, extended and verbose flags:

mysqldump -cev --user=<user> --password=<password> <dbname> > <file_location>/backup.sql

Upvotes: 4

Views: 86

Answers (1)

Ike Walker
Ike Walker

Reputation: 65547

This is the option you are looking for:

--skip-extended-insert

Upvotes: 6

Related Questions