How To Setup Mysql Mirroring
1) Create a user on the Main db server that the slave servers will use to connect. Command: GRANT FILE ON *.* TO backupuser IDENTIFIED BY ‘
‘;
1a) FLUSH PRIVILEGES;
2) Shut down main & backup mysql servers.
3) Copy your raw mysql data files ( be sure to use ‘cp -Rp’ or ‘tar’) from the main server to the backup server (for me it’s the /var/db/mysql directory). Then make sure the permissions are right.
4) On the Main server, open /etc/my.cnf and under [mysqld], add the following lines.
log-bin
server-id=1
(Note, when I shut off my main db server, I didn’t have the log-bin line in already. I do not think these instructions will work if the log-bin like is already in there)
5) Restart the main server.
6) On the backup sever, open /etc/my.cnf and under [mysqld], add the following lines.
master-host=
master-user=
master-password=
master-port=
server-id=
(replace with what is appropriate for your setup).
Then you can restart the backup mysql server and replication should be working.


