Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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
share|improve this answer
    
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
    
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. –  altmannmarcelo Apr 2 '13 at 13:53
1  
There are also replicate-do-table/replicate-ignore-table. Here are some more descriptions of what they do. –  Derek Downey Apr 2 '13 at 14:42
    
Thanks altmannmarcelo! –  PLui Apr 2 '13 at 15:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.