mysql 执行报错及解决方法 Multi-statement transaction required more than ‘max_binlog_cache_size‘
mysql數(shù)據(jù)庫執(zhí)行update語句,報錯。
導(dǎo)入數(shù)據(jù)庫的時候報了一個錯:
Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again
原因:mysql參數(shù)max_binlog_cache_size設(shè)置過小導(dǎo)致,默認(rèn)1M
? ? ? ? ? max_binlog_cache_size 表示的是binlog 能夠使用的最大cache 內(nèi)存大小.檢查binlog_cache_size的使用情況:
? ? ? ? ? 通過show global status like 'bin%';查看binlog_cache_size的使用情況。
? ? ? ? ? ??
? ? ? ? ? ? ? ----Binlog_cache_disk_use表示因為我們binlog_cache_size設(shè)計的內(nèi)存不足導(dǎo)致緩存二進(jìn)制日志用到了臨時文件的次數(shù)
? ? ? ? ? ? ? ----Binlog_cache_use??表示 用binlog_cache_size緩存的次數(shù)
? ? ? ? ? ? ? ?----Binlog_cache_disk_use 值比較大的時候要考慮適當(dāng)?shù)恼{(diào)高 binlog_cache_size 對應(yīng)的值
查看設(shè)置大小:
mysql> show global variables like '%binlog_cache%';
解決:
cat /etc/my.cnf
max_binlog_cache_size增大
注意點:
a.max_binlog_cache_size 表示的是binlog 能夠使用的最大cache 內(nèi)存大小
當(dāng)我們執(zhí)行多語句事務(wù)的時候 所有session的使用的內(nèi)存超過max_binlog_cache_size的值時
就會報錯:“Multi-statement transaction required more than 'max_binlog_cache_size' bytes ofstorage”
b.設(shè)置太大的話,會比較消耗內(nèi)存資源;設(shè)置太小又會使用到臨時文件即disk
配置:
a.配置文件設(shè)置my.cnf
binlog_cache_size?= 10M
修改配置后需要重啟才能生效:service mysql restart
?
總結(jié)
以上是生活随笔為你收集整理的mysql 执行报错及解决方法 Multi-statement transaction required more than ‘max_binlog_cache_size‘的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 阿拉德之怒狂战加点(《阿拉德之怒》停运)
- 下一篇: sql delete删除两个表_超强干货