My (SQL) WorkLog: MySQL - Restoring a single database from a backup file contaning multiple databases

Saturday, June 20, 2009

MySQL - Restoring a single database from a backup file contaning multiple databases

Sometime (rather I would say most of the time) you may need to restore a single/specific database from the nightly backup but unfortunately your nightly backup contains all the other databases and restoring all the databases is not the solution as we may end up losing some of the data which might be added to the databases after the nightly backup. Fortunately there is one option "--one-database" available in the 'mysql' command line utility which comes into our rescue.


In order to restore a single database from the nightly backup you can use the --one-database or -o option when restoring
shell>mysql --one-database required_db < /path/to/backup.sql


2 comments:

Moole said...

Hi Umesh,
Good one.
Regards,
Moole

Moole said...

Hi Umesh,
Good One.
Regarrds,
Moole

Post a Comment