Can someone tell me how to prevent the following commands
DROP TABLE <tbl-name>;
TRUNCATE TABLE <tbl-name>;
from being replicated to slaves?
MySQLmysql-5.1replication
Can someone tell me how to prevent the following commands
DROP TABLE <tbl-name>;
TRUNCATE TABLE <tbl-name>;
from being replicated to slaves?
Best Answer
Disable binary logging in your session, drop the table, and enable binary logging.
This works because if the Slaves do not see the
DROP TABLE
command registered in the Master's binary logs, it cannot run theDROP TABLE
.I have recommended using
SET sql_log_bin = 0;
before in my earlier postsNov 12, 2012
: Mysql replication and ignore tablesFeb 03, 2012
: Scheduled optimization of tables in MySQL InnoDBJul 11, 2011
: ALTER TABLE on a large table with an indexed column (This is where I useSET sql_log_bin = 0;
to directly prevent data from being written to Slaves)Give it a Try !!!