Moving a MySQL database


I am switching to Dreamhost from another host. That in mind, I set up my dreamhost account on [my domain] to test things out (ie my site is mirrored, and my MySQL db is at [db name].[domain name]

Given that things are working, I’d like to move my MySQL database to the production MySQL server but am not sure how to do it. Can someone please tell me how to make the move?

Also, does Dreamhost automatically make backups of MySQL databases? If so, where are they kept?



To dump your database to a file:
/usr/bin/mysqldump --all-databases -hHOSTNAME -uUSERNAME -p > dump.sql

To load your DH database:
/usr/bin/mysql -hHOSTNAME -uUSERNAME databasename < dump.sql

Dreamhost does keep backups of your databases for up to two months using daily snapshots. I don’t think you can get to your database snapshots since they’re not on your home server, but you can use the MySQL Control Panel to do a restore.