I back up my production database with the following command:

mysqldump -u root --opt --skip-extended-insert --databases my_production_db

The resulting dump file has the following lines near the top:

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `my_production_db` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `my_production_db `;

In order to restore the database to a different destination ie. my_debvelopment_db I have to open the dump file and edit the bits where the database is named.

Then I run:

mysql -u root  -p <password> < mydumpfile

I have not figured out another way to do it.

As the database gets bigger this becomes impractical.

Am I missing something? Cant I somehow specify where I want to restore the database? Would I need a different backup command?

Edit
Report