MY SQL Mirroring
MY SQL Mirroring
Now move yourself to MySQL from command prompt with following command:
Master 1
• mysql>CREATE USER 'replication_user'@'%' IDENTIFIED BY 'replication';
• mysql>GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'%';
Master 1
• mysql>CREATE USER 'replication_user'@'%' IDENTIFIED BY 'replication1';
• mysql>GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'%';
MASTER 2
Luckily we have the same result for both masters take a note for the values of File and Position
CONNECT FROM ONE MASTER TO ANOTHER
change master host in both of your server:
Master 1
CHANGE MASTER TO MASTER_HOST = '192.168.2.4', MASTER_USER =
'replication_user', MASTER_PASSWORD = 'replication1', MASTER_LOG_FILE = 'mysql-
bin.000001', MASTER_LOG_POS = 98;
Master 2
CHANGE MASTER TO MASTER_HOST = '192.168.2.3', MASTER_USER =
'replication_user', MASTER_PASSWORD = 'replication', MASTER_LOG_FILE = 'mysql-
bin.000001', MASTER_LOG_POS = 98;
Remember to use stop slave command before CHANGE MASTER
Master 1
Master 2
• Start the slave you stopped with START SLAVE command ;
• Then type show slave status\G command in both systems
Master 1 master 2