Duplicating a database in MySql

Often during development we have to create a copy of database for setting up a new environment. One option is to export the database to a file and then import it from file into new database. Or we can use the following command in Linux to duplicate database in mysql


mysqldump -hhost -uroot -p databasenameexport | mysql -hhost -uroot -p databasenameimport

Leave a Comment

Back to top