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.
- Run the "mysqldump" program and pipe it directly back into "mysql":
mysqldump --user=<username> --password=<password> <existingdatabase> | mysql --user=<username> --password=<password> <newdatabasename>
- That's it!