Mysql: Duplicate a Database

I needed to duplicate one of my mysql magento databases today. Instead of dumping it to my computer, then sending it back into a different database, I figured there’s got to be a more efficient way to do it. Fortunately there is. Create the database, then run this from your command line:

mysqldump -u [user] --password=[password] databasetodupe | mysql -u [user] --password=[password] newdatabase

This entry was posted in MySQL. Bookmark the permalink.

Comments are closed.