Need help? Call us on 1300 789 260

How to copy a MySQL database

Difficulty: Advanced


  • Access to your Linux based VPS


Copying your existing MySQL database is quite a simple task, in fact you can do it in a single command! There are plenty of times when you want to take a copy of an existing database so that you leave your original database untouched. For example, if you want to run different databases for your production and development environments then you can copy the existing database to test making changes.

Note: This assumes that you're copying the database onto the same server.


  1. Run the "mysqldump" program and pipe it directly back into "mysql":
    mysqldump --user=<username> --password=<password> <existingdatabase> | mysql --user=<username> --password=<password> <newdatabasename>
  2. That's it!
Was this article helpful? Yes No

Having trouble? We’re here to help!

We’ve built our company with a serious focus on quality service. Feel free to give us a call!

1300 789 260