SET sql_log_bin = {OFF|ON}
The sql_log_bin
variable
controls whether logging to the binary log is enabled for the
current session (assuming that the binary log itself is
enabled). The default value is ON
. To disable
or enable binary logging for the current session, set the
session sql_log_bin
variable to
OFF
or ON
.
Set this variable to OFF
for a session to
temporarily disable binary logging while making changes to the
master you do not want replicated to the slave.
Setting the session value of this system variable is a restricted operation. The session user must have privileges sufficient to set restricted session variables. See Section 5.1.8.1, “System Variable Privileges”.
It is not possible to set the session value of
sql_log_bin
within a
transaction or subquery.
As of MySQL 5.5.41, the global
sql_log_bin
variable is read
only and cannot be modified. The global scope is deprecated and
will be removed in a future MySQL release. Prior to 5.5.41,
sql_log_bin
can be set as a
global or session variable. Setting
sql_log_bin
globally is only
detected when a new session is started. Any sessions previously
running are not impacted when setting
sql_log_bin
globally.
Incorrect use of sql_log_bin
with a global scope means any changes made in an already
running session are still being recorded
to the binary log and therefore replicated. Exercise extreme
caution using sql_log_bin
with a global scope as the above situation could cause
unexpected results including replication failure.