I have a simple MySQL replication setup with one master and two slaves. Occasionally there are queries that get executed on the Master which fail due to duplicate unique keys or other reasons. What I'm seeing is that the failing queries are getting replicated to the slave servers, which causes errors there too. It's annoying and quite tedious to have to go and fix this every time, since replication stops every time there's a bad query.

It seems to me that if a query fails on the Master, then MySQL should not bother propagating it to the Slaves. Can MySQL be configured this way? How? I've tried Googling and browsing the MySQL docs, but I'm not seeing it.


The MySQL replication happens through binlog. To the binlog only successful transactions will be written, so if a query fails on a master it won't appear in binlog. That means this kind of queries will not appear on replicas. If you have errors like replication stops on slave1 because there is no column for update (etc.) then that means your master and slaves are differ. You should install percona-toolkit, and check your tables with pt-table-checksum.

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.