MySQL – How to Replicate Only One Database

MySQLreplication

I just wanted to check on the replication setup I've got working. The plan was to replicate just one database, so per the MySQL documentation I used the replicate-do-db flag in my MySQL configuration. However per the documentation it says it won't work if your code uses "db.table" format of inserts…

Note that this does not replicate
cross-database statements such as
UPDATE some_db.some_table SET
foo='bar' while having selected a
different database or no database.

So, does my combination of the replicate-do-db flag AND the replicate-wild-do-table flag fix this?

replicate-do-db = replicate_me
replicate-wild-do-table = replicate_me.%

I was just wondering, as the replication works as needed.

Best Answer

It's not that all db.table INSERTs won't work, it's that cross-database ones won't (see the example in the doc page you link to). Your replication probably works because you're not doing any cross-database INSERTs; most people don't.

replicate-wild-do-table won't change anything for this purpose.