I have data replication setup on MySQL. If I delete data on the master, will replication know data was deleted and automatically delete the same data on slave?


Yes, it will automatic apply the delete on the slave, with some restrictions:

  • If you have replicate-do-db=db_name enabled, it will automatically filter out the statements to the given database names
  • If you have replicate-ignore-db=db_name enabled, it will automatically filter out statements to the given table names
  • pardon my ignorance but how do I check if those two settings are enabled? Also, what does "delete just the statements" mean? Is that the equivalent of deleting the data? I'm not really understanding the difference between the two restrictions...
    – PLui
    Apr 2 '13 at 13:46
  • 1
    to check run SHOW VARIABLES LIKE '%replicate%'; if you have replicate-do-db it will replicate statements(queries) just to db that you specify in this field. if you have replicate-ignore-db it will replicate statements(queries) to dbs that isn't in this option, if you don't have anything in this 2 options it will replicate everything. Apr 2 '13 at 13:53
  • 2
    There are also replicate-do-table/replicate-ignore-table. Here are some more descriptions of what they do. Apr 2 '13 at 14:42

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.