mysql报错Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage

mysql报错Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage

 

在执行create table  xx  as  select xx的时候

或者在执行

tpcc-mysql的tpcc_load 的时候

都会遇到这个错误

 

1534, HY000, Writing one row to the row-based binary log failed
Retrying ...

1197, HY000, Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again
Retrying ...

 

 

因为使用的是腾讯云主机,1核1G内存,内存不足导致的binlog cache size不够不能写入binlog,导致语句无法执行

 

解决办法:

修改my.cnf,增大binlog_cache_size和max_binlog_cache_size参数的值

binlog_cache_size = 20M
max_binlog_cache_size = 100M

 


今天备份表数据遇到一个错误  Error CODE: 1197 Multi-statement TRANSACTION required more THAN 'max_binlog_cache_size' bytes of STORAGE

 

 

版本:mysql5.6.35

系统:centos6.5

下面是备份语句

CREATE TABLE FONTANA_BETSBAK AS SELECT * FROM FONTANA_BETS; 

 

 

Error CODE: 1197
Multi-statement TRANSACTION required more THAN 'max_binlog_cache_size' bytes of STORAGE; increase this mysqld variable AND try again

 

 

上网搜了一下,发现是max_binlog_cache_size设置得不够大的原因

对Innodb引擎
由于innodb是事务型的,所以会把load文件的整个操作当作一个事务来处理,
中途中断load操作,会导致回滚。 
与此相关的一些参数:
max_binlog_cache_size----能够使用的最大cache内存大小。
当执行多语句事务时,max_binlog_cache_size如果不够大,
系统可能会报出“Multi-statement
transaction required more than 'max_binlog_cache_size' bytes of storage”的错误。
 备注:以load data 来说,如果load的文件大小为512M,在执行load 的过程中,
所有产生的binlog会先写入binlog_cache_size,直到load data 的操作结束后,
最后,再由binlog_cache_size 写入二进制日志,如mysql-bin.0000008等。
所以此参数的大小必须大于所要load 的文件的大小,或者当前所要进行的事务操作的大小。

 

改大max_binlog_cache_size 和binlog_cache_size  问题解决

SET GLOBAL max_binlog_cache_size =20971520;
SET GLOBAL binlog_cache_size =20971520;

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值