Stream Mysqldump Output to MySQL

Posted in Database

This post will be a short and sweet one. Copying/cloning a database between mysql hosts in a single command can be done with:

mysqldump -h old_host -u old_user -p old_password old_db_name | mysql -h new_host -u new_user -p new_password new_db_name

Note that this will dump the entire database down to your machine before re-uploading it to the new host.