HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Replication with only update and insert

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
updateinsertwithreplicationandonly

Problem

I have set up my replication but I want to delete some outdated data from my master tables. Is it possible that say if I have 10 records at master and I delete 5 of them but I want those 10 records to remain on the slave?

Solution

If you're just going to delete this extra data manually on the odd occasion, you can simply turn off the binary logging for the current session. On the MySQL prompt run the following:

set sql_log_bin=0;

Then any query you enter won't be sent to the binary log, and thus won't be sent across to the slaves.

Once you're finished, re-activate binary logging with

set sql_log_bin=1;

Reference: MySQL manual

Context

StackExchange Database Administrators Q#18037, answer score: 3

Revisions (0)

No revisions yet.