Rectangle 27 676

I can see you said you didn't want to use mysqldump, but I reached this page while looking for a similar solution and others might find it as well. With that in mind, here is a simple way to duplicate a database from the command line of a windows server:

  • 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.
  • 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]

/what would actually be a good reason NOT to use mysqldump?

The case against mysqldump is that there has to be a faster way then serializing the data into queries, transmitting the queries outside of the process and through the tty back into the exact same process, reparsing the queries, and executing them as statements. That sounds horribly inefficient and unnecessary. We're not talking about crossing between MySQL masters or changing storage engines. It's shocking there is no efficient intraprocess binary transfer.

If you don't want to save the password plaintext in your terminals history, you need to split the command: mysqldump -h [server] -u [user] -p db1 > db1, mysql -h [server] -u [user] -p db2 < db1 Otherwise the password prompt messes it up, at least for me when using putty.

mysqldump -u root -p -v db1 | mysql -u root -p db2

mysql - Copy/duplicate database without using mysqldump - Stack Overfl...

mysql
Rectangle 27 673

I can see you said you didn't want to use mysqldump, but I reached this page while looking for a similar solution and others might find it as well. With that in mind, here is a simple way to duplicate a database from the command line of a windows server:

  • 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.
  • 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]

/what would actually be a good reason NOT to use mysqldump?

The case against mysqldump is that there has to be a faster way then serializing the data into queries, transmitting the queries outside of the process and through the tty back into the exact same process, reparsing the queries, and executing them as statements. That sounds horribly inefficient and unnecessary. We're not talking about crossing between MySQL masters or changing storage engines. It's shocking there is no efficient intraprocess binary transfer.

If you don't want to save the password plaintext in your terminals history, you need to split the command: mysqldump -h [server] -u [user] -p db1 > db1, mysql -h [server] -u [user] -p db2 < db1 Otherwise the password prompt messes it up, at least for me when using putty.

mysqldump -u root -p -v db1 | mysql -u root -p db2

mysql - Copy/duplicate database without using mysqldump - Stack Overfl...

mysql