Duplicating a mysql database

Here is a simple way to duplicate a database from the command line of a windows server:

1.Create the target database using MySQLAdmin or your preferred method. In this example, db2 is the target database, where the source database db1 will be copied.
2.Execute the following statement on a command line:

mysqldump -h [server] -u [user] -p[password] db1 | mysql -h [server] -u [user] -p[password] db2

Note: There is NO space between -p and [password]

If you do not want to add the password on the command line, you can leave that blank and you will be prompted for it.

Posted in Software Development.

Leave a Reply

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