Mysql – Created databases and inserted data on MySQL slaves in Master-Slave replication – how to fix

MySQLreplication

I got MySQL Master-Slave replication running on 1 master with 2 slaves. SHOW MASTER STATUS / SHOW SLAVE STATUS says they are in sync, but databases have been created on the slaves and filled with data which of course cannot be seen on the other slaves/master, because no replication from Slave to Master happened.

Is there an easy way to fix this situation? Two outcomes would be acceptable for me, but I'm not sure what is the best way to achieve this (sorry, DBA noob):

  • No replication at all, but no data lost on each server in its current state (replicated data stays in its current state, new data on the slave stays there, too)
  • Converting Master-Slave to Master-Master-Replication so every server has the same data.

Best Answer

You say:

databases have been created on the slaves and filled with data.

The easiest way of correcting this is to take a mysqldump of the specific databases on the slave, drop the database on the slave, and import the dumpfile onto the master. The slaves will then replicate the data.

This of course gets trickier if it is not whole databases or even tables (but specific rows inside a table).