MySQL Extract Single Database From Dump File

Published by Torry Crass on

Here's a quick command line entry using sed to dump out a single MySQL database from a multi-database backup file.  This script assumes the DB file is comopressed with gzip.

gunzip -c sqldumpfile.sql.gz | sed -n '/^-- Current Database: `your_db_name`/,/^-- Current Database: `/p' > your_db_name.sql



Leave a Reply