MySQL per-database replication

migrationMySQLreplication

So, my problem is interesting: we want to migrate from one server to another. We made a master-slave replication, but my boss came with the idea to make migration one database at a time.

So he asked me to setup at the new server another MySQL instance, let the slave almost as-is and make the new instance be the new master incrementally, one database at a time. Is it possible, that is, can I transfer the database 'x' from old master to new master and just tell slave to synchronize 'x' at the new master from now on?

I've read at this old thread ( Mysql Replication – are per-database threads possible? ) that this was not possible at that time. This can be done now?

Thanks!

Lucas Bracher.

Best Answer

Yes, you can do this. MySQL's replication allows you to specify which schemas to replicate[1] or not, look for the replicate_wild_do_table parameter.

However, it is also very silly to do this, as you will need some downtime for each migration to make sure there is no data loss, and I also can't think of a good reason not to simply replicate all the databases.

[1] The slave will still fetch the complete binlog, but only execute statements that match the filter(s)

Related Topic