Here we've two MySQL server instances, namely mysql and mysql1.
We will setup Master-Slave Replication from mysql1 to mysql. Later we will setup Master-Slave Replication from mysql to mysql1.
For your reference please check the appendix section for sample configuration files along with below mentioned instructions.
1. Setting Master Slave "mysql1 --> mysql":
mysql1 @ port: 3307 as Master mysql @ port: 3306 as Slave
- On mysql1(master): Add following line to my.ini:
** Check for working Master-Slave ** ** Check for working Master-Master **
And that's it. We now have two different instances of MySQL server running with a Master-Master replication scheme. Hopefully, you found this tutorial helpful. Please see examples of the final configuration files in the appendix below along with references for more information regarding this topic.
Appendix: Configuration Files for master-master mysql setup:
Following is the my.ini [configuration] file for first MySQL Server Instance:
##my.ini for mysql (Regularly installed):[client]port=3306[mysqld]server-id=2port=3306# Replicationlog-bin=binlog#For this as master:binlog-do-db=masterbinlog-ignore-db=mysql binlog-ignore-db=test#Conn. Pmtr for slave:master-host = localhostmaster-user = replication1master-password = slave1master-port = 3307basedir="C:/Program Files/MySQL/MySQL Server 5.0/"datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"auto_increment_increment=1auto_increment_offset=1
Following is the my2.ini [configuration] file for second MySQL instance named "mysql1":
##my2.ini for Mysql1: [client]port=3307[mysqld]server-id=1port=3307# Replicationlog-bin=binlog#For this as master:binlog-do-db=masterbinlog-ignore-db=mysqlbinlog-ignore-db=test#Conn. Pmtr for slave:master-host = localhostmaster-user = replication2master-password = slave2master-port = 3306basedir="C:/Program Files/MySQL/MySQL Server 5.0/"datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data1/"auto_increment_increment=1auto_increment_offset=2