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.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">