All HowTo's MySQL & MariaDB

Restore a single MySQL DB from a Dump using –all-databases

The link below shows a simple way to restore one the MySQL database that you want from a dump that included all databases.

Extracting a Database From a mysqldump File

The good people who wrote that article (can) take credit for the following:

shell> sed -n '/^-- Current Database: `mydb`/,/^-- Current Database: `/p' dump.sql > mydb.sql

Where “mydb” is the name of the database that you want to extract. The above is a single line.

Leave a Reply

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