Sep 13, 2018

How to prevent replication of some MySQL queries

If you want to prevent any MySQL query from executing on a Slave, just run this on the Master:

SET SQL_LOG_BIN=0;
# a query you don't want to replicate
# another query you don't want to replicate
SET SQL_LOG_BIN=1;

This prevents the Master from recording the queries in its binary logs. Since the Slave only replicates from the binary logs of the Master, just don't record the commands that you do not want replicated.