views:

160

answers:

1

Is it possible to import a single database from an --all-databases mysqldump? I guess I can modify the file manually but wondering if there are any command line options to do this.

I am moving servers and have a lot of databases, most of which I don't currently need or want at the moment but would like to have the option to restore a single one if need be.

+3  A: 

mysqldump output is just a set of SQL statements.

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

mysql -D mydatabase -o < dump.sql

This will only execute the commands when mydatabase is in use

Quassnoi
Thanks for the fast answer! Awesome.
savageguy