Duplicate Entire MySQL Database
To remote server
mysqldump mydbname | ssh host2 "mysql mydbcopy"
To local server
mysqldump mydbname | mysql mydbcopy
First create the duplicate database:
CREATE DATABASE duplicateddb;
Make sure the user and permissions are all in place and:
mysqldump -u admin -p originaldb | mysql -u backup -pPassword duplicateddb;
I sometimes do a mysqldump and pipe the output into another mysql command to import it into a different database.
mysqldump --add-drop-table -u wordpress -p wordpress | mysql -u wordpress -p wordpress_backup