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.
Reference:
The --skip-extended-insert option reference
Share "How to create INSERT statement for each record with mysqldump?"
Related snippets:
- Import an SQL file using the command line in MySQL
- Backup only certain rows from MySQL database
- Create INSERT statement for each record with mysqldump
- Backup MySQL database without locking tables
- Backup MySQL data only
- Skip tables in MySQL backup
- Backup only selected tables in MySQL
- Backup MySQL schema only
- Backup MySQL database
Tags:
one insert for each record, one insert statement for each data row Technical term:
Create INSERT statement for each record with mysqldump