//Random Tip
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow

You are viewing a random entry, refresh your browser to change.

Tip 669 gave a command to copy a table between remote MySQL databases, but how about if you want to copy the whole DB to a new host?

The following command will copy the database 'old_db' from the local host to 'new_db' on the specified remote host.

mysqldump --add-drop-table --extended-insert --force --log-error=err.log -u[user] \
-p[pass] old_db | ssh -C user@host "mysql -u[user] -p[pass] new_db"


View Comments »



Comments 

Add your comment

Comments are currently disabled
Marius
Mysql has -h option no need for ssh ;)
Posted 2009-05-01 18:07:28

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit