- Instant help with your Sql coding problems

Create INSERT statement for each record with mysqldump

Question:
How to create INSERT statement for each record with mysqldump?
Answer:
mysqldump -u testuser -p testdb --skip-extended-insert > /tmp/backup_insert_each.sql
Description:

If you want to create one INSERT statement for each record during backup use the --skip-extended-insert option of the mysqldump utility.

Using the --skip-extended-insert option mysqldump writes INSERT statements using one-row syntax that includes only one record in one statement. This results in a bigger dump file and slows down inserts when the file is reloaded.

This can be useful if you want to compare different database dumps as in this case the diff result is more readable.

Share "How to create INSERT statement for each record with mysqldump?"