MySQL复制:暂时阻止特定的SQL语句复制到从属服务器? [英] MySQL replication: temporarily prevent specific SQL statements replicating to the slaves?

查看:52
本文介绍了MySQL复制:暂时阻止特定的SQL语句复制到从属服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想连接并执行一个(有时是几个)SQL语句,而不要将那些语句复制到从属服务器上.

I want to connect and execute one (or sometimes several) SQL statements, and NOT have those replicated to the slaves.

我没有执行复制或忽略操作的配置,因此我无法use从某些非复制数据库发送命令.我知道:

I have no replicate-do or replicate-ignore configs, so I can't use some non-replicated database to send the commands from. And I know about:

set global sql_slave_skip_counter = 1

但是那是在奴隶上.我希望能够在主服务器上运行类似的命令,并且不将以下N条命令发送给从服务器(我想这也意味着没有登录到二进制日志中).

But that's on the slave. I'd like to be able to run a similar command on the master and have the following N commands not sent out to the slaves (which I guess means not logged in the binlogs, either).

推荐答案

SET sql_log_bin=0是您要寻找的.需要SUPER priv.,并且将关闭会话中命令的记录,直到将其设置回1.请参见

SET sql_log_bin=0 is what you're looking for. Requires SUPER priv., and will turn off logging of commands from your session until you set it back to 1. See http://dev.mysql.com/doc/refman/5.0/en/server-session-variables.html#sysvar_sql_log_bin

SET sql_log_bin=0;
UPDATE ... ;
INSERT ... ;
DELETE ... ;
SET sql_log_bin=1 ;

这篇关于MySQL复制:暂时阻止特定的SQL语句复制到从属服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆