免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4253 | 回复: 6

sql_log_bin 的小问题 [复制链接]

求职 : Linux运维
论坛徽章:
203
拜羊年徽章
日期:2015-03-03 16:15:432015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:57:092015小元宵徽章
日期:2015-03-06 15:58:182015年亚洲杯之约旦
日期:2015-04-05 20:08:292015年亚洲杯之澳大利亚
日期:2015-04-09 09:25:552015年亚洲杯之约旦
日期:2015-04-10 17:34:102015年亚洲杯之巴勒斯坦
日期:2015-04-10 17:35:342015年亚洲杯之日本
日期:2015-04-16 16:28:552015年亚洲杯纪念徽章
日期:2015-04-27 23:29:17操作系统版块每日发帖之星
日期:2015-06-06 22:20:00操作系统版块每日发帖之星
日期:2015-06-09 22:20:00
发表于 2015-10-06 22:27 |显示全部楼层
@ipigzhu
可以         

论坛徽章:
6
数据库技术版块每日发帖之星
日期:2015-10-11 06:20:00数据库技术版块每日发帖之星
日期:2015-10-12 06:20:00数据库技术版块每日发帖之星
日期:2015-10-15 06:20:00数据库技术版块每日发帖之星
日期:2015-10-30 06:20:00综合交流区版块每月发帖之星
日期:2015-12-02 14:59:01数据库技术版块每日发帖之星
日期:2015-12-15 06:20:00
发表于 2015-10-08 17:40 |显示全部楼层
sql_log_bin是暂时停止binlog的记录(可以动态关闭或开启),如果放在my.cnf就是停止binlog的记录(无法动态再开启)


如果在mysql的配置文件配置启动了二进制日志,mysql会一直记录二进制日志,修改配置文件,可以停止二进制日志,

但是需要重启mysql数据库。mysql提供了暂时停止二进制日志的功能。通过 SET SQL_LOG_BIN 语句可以使mysql暂停或者启动二进制日志

论坛徽章:
3
数据库技术版块每日发帖之星
日期:2015-10-08 06:20:00操作系统版块每日发帖之星
日期:2015-11-10 06:20:00IT运维版块每日发帖之星
日期:2016-01-17 06:20:00
发表于 2015-10-26 22:42 |显示全部楼层
回复 2# love100



哥哥 ,概念我懂。但是做的实验结果,和我的有差异啊??怎么回事??

   

论坛徽章:
6
数据库技术版块每日发帖之星
日期:2015-10-11 06:20:00数据库技术版块每日发帖之星
日期:2015-10-12 06:20:00数据库技术版块每日发帖之星
日期:2015-10-15 06:20:00数据库技术版块每日发帖之星
日期:2015-10-30 06:20:00综合交流区版块每月发帖之星
日期:2015-12-02 14:59:01数据库技术版块每日发帖之星
日期:2015-12-15 06:20:00
发表于 2015-10-27 11:28 |显示全部楼层
什么样的差异?

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
发表于 2015-10-30 16:29 |显示全部楼层
回复 3# ipigzhu


    试验步骤和试验结果发出来,我也试试。

论坛徽章:
3
数据库技术版块每日发帖之星
日期:2015-10-08 06:20:00操作系统版块每日发帖之星
日期:2015-11-10 06:20:00IT运维版块每日发帖之星
日期:2016-01-17 06:20:00
发表于 2015-10-30 22:23 |显示全部楼层
回复 4# love100



设置sql_log_bin=off 应该不记录sql,对吧,怎么还会记录? ?? 就这么简单问题!!
   

论坛徽章:
0
发表于 2015-11-02 14:08 |显示全部楼层
mysql> help sql_log_bin;
Name: 'SET SQL_LOG_BIN'
Description:
Syntax:
SET sql_log_bin = {0|1}

The sql_log_bin variable controls whether logging to the binary log is
done. The default value is 1 (do logging). To change logging for the
current session, change the session value of this variable. The session
user must have the SUPER privilege to set this variable. Set this
variable to 0 for a session to temporarily disable binary logging while
making changes to the master which you do not want to replicate to the
slave.

As of MySQL 5.5, 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.

*Warning*: 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.

In MySQL 5.6, it is not possible to set @@session.sql_log_bin within a
transaction or subquery. (Bug #53437)



首先是你要看是session级别还是global级别,同时看是不是同一个session
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP