Extract Backup of one database from mysqldump all databases

When you backup MySQL Server with command

mysqldump  --all-databases > all-db.sql

You get a MySQL backup file containing all databases.

If you want to generate MySQL backup for single database from this file, you can run

sed -n '/^-- Current Database: `DB_NAME`/,/^-- Current Database: `/p' all-db.sql > DB_NAME.sql

See mysqldump

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *