Import single database from –all-databases dump

on February 7th, 2017 by Hades | No Comments »

Sometimes you can appear a question: “Is it possible to import a single database from an –all-databases mysqldump?”. Yeah, it’s possible…

You can provide the desired database in the command line and skip the commands against the other databases using:

mysql -D --disable-keys Your_database_name -p -o < dump.sql

–disable-keys for avoid errors of foreign keys
-o, –one-database Ignore statements except those that occur while the default database is the one named at the command line.
-D, –database=name Database to use.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.