We have 2 Mysql 5.7 servers running in master-master replication mode.

And there is a database replicating between these 2 servers:

binlog_do_db = database1

Now we need to add a new database into replication, I have read Add database to existing replication which uses binlog_do_db?, but its for master-slave. Is there any other things should be considered for master-master situation?

  • What is the method your are using ? Galera Cluster or Group Replication ? or older method ?
    – HamoonDBA
    Nov 8, 2017 at 8:05

2 Answers 2


Master-Master is simply Master-Slave in both directions. So all the settings work the same.

Data does not endlessly loop between the two Masters as long as they don't have the same server_id.

I'm pretty sure you simply have multiple lines. See https://forums.mysql.com/read.php?26,255998,255998

M-M is fraught with perils, but I guess you have gotten past them. So I won't harp on it.


You can Edit my.cnf to include many new databases as you want but binlog-do-db behaves itself if you have always selected your database before run your query.

By example you have 3 datatabases on your master 1 and would like to replicate only 2 on master 2 and use this solution :

binlog_do_db = database1

binlog_do_db = database2

by running this query on master1 :

delete from database3.testTable where id='yy';

will broke your replication because database3 does not exists on master2: please read this article from percona before filtering https://www.percona.com/blog/2009/05/14/why-mysqls-binlog-do-db-option-is-dangerous/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.