Just as the topic states.

Is it possible to issue an INSERT / UPDATE / DELETE and specify for it not to be relayed to attached slaves in mysql?

1 Answer 1


Here is a quick and dirty answer:

Simply run SET SQL_LOG_BIN=0; before each SQL command. It prevents subsequent SQL from entering the Master's binary log upon the completion of any SQL statement afterwards. Thus, it cannot be shipped forward to any Slave. However, there will be no record of the SQL being executed in the Binary Logs.

Within the given DB Connection, if you want to start recording again, just run SET SQL_LOG_BIN=1; before each SQL command.

Opening a new connection will having binary logging enabled within it by default.

  • Just making sure... This is a 'session' setting not a global one? Thanks! Commented Feb 6, 2012 at 20:23
  • It's per session, not global.
    – atxdba
    Commented Feb 6, 2012 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.