Step 4: Mirroring MySQL databases with mysqldump
We will use mysqldump to synchronize your mirror and production server databases. Before running mysqldump, you will need to create a MySQL user on your mirror server, and you will need to create empty databases with the same names as the databases on your production server.
Once you have setup your mirror server databases, log into your mirror via ssh, and run the following command to sync a database:
mysqldump -h productionIP -u productionMySQLuser -pproductionPassword productionDBname | mysql -h mirrorIP -u mirrorMySQLuser -pmirrorPassword mirrorDBname
- productionIP - the IP address of your production server
- productionMySQLuser - the MySQL user on your production server
- productionPassword - the password for your MySQL user on your production server (be sure to type your password immediately after typing the "-p" -- no spaces)
- productionDBname - name of the production server database that you want to backup
- mirrorIP - the IP address of your mirror server
- mirrorMySQLuser - the MySQL user on your mirror server (you will need to create this user via your mirror CPanel)
- mirrorPassword - the password for the MySQL user on your mirror server
- mirrorDBname - the database you are backing up to on your mirror server (this database will need to be named the same as the database on your production server, and you will need to create this database before running mysqldump)
Once you have your mysqldump running properly, add the command to your crons list in the CPanel. Now you are ready for Step 5: Enabling DNS Failover Switching


Hi,
Please could you tell me if you have ever done mirroring for the plesk web servers.
Thanking you.
Regards,
Naseer.
This is for ressellers, how to backup entire dedicated server with cpanel and whm???
the sql sync isn“t good enough, imagine if i need to create all database of accounts??? is it possible to copy all information between the servers???
thanks - but at all is very good tutorial....
Michael, I find your article very informative and helpfull. Thank you very much for same.
Was wondering since you posted it on 2007, how has the setup performed since then? Are you still using it or have you moved to a more advanced setup.
Just want to get your production experience of it, before I implement it on a bunch of websites.
Thanks in advance.
If the server still asks for password then you need to check the following permission in your server.
* Change the permissions of .ssh to 700
* Change the permissions of .ssh/authorized_keys2 to 640
It took me 2 days to figure this out.