I have two MySQL servers (A and B) running on separate machines. I want to replicate database X on A to B. B is still master for other databases. How do I set this up so that B is only slaved for X but master for the others? I currently have A configured to only replicate-do-dbs=x.


To do this, you don't want to have any filtering on the the Master A server. Instead you will want to use replicate filters on the slave, Server B

For a full understanding of replication filters, have a read through this documentation and its sublinks. I will highlight two caveats (emphasis mine):

On the master, you can control which databases to log changes for by using the --binlog-do-db and --binlog-ignore-db options to control binary logging.....You should not use these options to control which databases and tables are replicated. Instead, use filtering on the slave to control the events that are executed on the slave.


To make it easier to determine what effect an option set will have, it is recommended that you avoid mixing “do” and “ignore” options, or wildcard and nonwildcard options.

With these two pieces of information, I'd recommend setting up server B with --replicate-wild-do-table=db_name.%. This is because:

If you need cross-database updates to work, use --replicate-wild-do-table=db_name.% instead. [src]

  • It seems like binlog_format=ROW on MASTER A would also be essential since cross-database statement-based queries would not replicate correctly. – Michael - sqlbot Sep 16 '15 at 9:52

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.