MySQL replication without delete statments
mysql
Solution
There are several ways to do this.
- Run `SET SQL_LOG_BIN=0;` for the relevant session on the master before executing your delete. That way it is not written to the binary log
- Implement a `BEFORE DELETE` trigger on the slave to ignore the deletes.
I tend to use approach #1 for statements that I don't want to replicate. It requires `SUPER` privilege.
I have not tried #2, but it should be possible.
Problem
I have been looking for a way to prevent MySQL delete statements from getting processed by the slave, I'm working on data warehousing project, and I would like to delete data from production server after having data replicated to slave. what is the best way to get this done? Thank you