How to restore dump of single database from Dump in MYSQL

Suppose you have a dump of more than one databases in a single dump file, then you can restore one or all the databases.

mysql -u root -p --one-database DBNAME < DUMPFILE.SQL

You should take care of a few things when you take the dump.

  • Create a database by that name in mysql if it does not exist.
  • Switch to the database you want to restore, this will help restore the database properly.
  • You need to be outside mysql environment to run this command.
For more specific restoration of databases from a dump file you can try mydumpsplitter. 

No comments:

Powered by Blogger.