位置: 编程技术 - 正文
推荐整理分享MySQL:Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEM,希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!
1:错误日志大量错误
:: [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave. Statement:INSERT INTO tab_name
2:原因:
查了下原因,tab_name 这个表上有2个唯一键。则使用INSERT … ON DUPLICATE KEY UPDATE ,且当前数据库binlog_format是statement格式,这种sql语句就会报unsafe。
官方手册:
INSERT … ON DUPLICATE KEY UPDATE statements on tables with multiple primary or unique keys.When executed against a table that contains more than one primary or unique key, this statement is considered unsafe, being sensitive to the order in which the storage engine checks the keys, which is not deterministic, and on which the choice of rows updated by the MySQL Server depends.
解决方法:
把binlog_format设置为ROW或者STATEMENT或者修改SQL。
一般情况下就是mysql配置问题,大家可以参考这篇文章:
MySQL MyISAM 优化设置点滴 最近在配置mysql服务器需要用到的一些设置,经过测试发现比较不错的配置方案,亮点在最后啊先说一点问题:Mysql中的InnoDB和MyISAM是在使用MySQL中最常用
Linux系统下Mysql使用简单教程(一) 如果你会查询这些相关的问题,说明你是一个正在或者准备从事IT的程序猿,对于一个程序猿而言,不会使用linux系统的程序猿不是一好的程序猿哦!因
Mysql使用简单教程(二) 接上文Linux系统下Mysql使用简单教程(一)字段参数以(字段名1数据类型1,字段名2数据类型2,......)的形式构建。关于mysql常用的数据类型,一下是比
标签: MySQL:Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEM
本文链接地址:https://www.jiuchutong.com/biancheng/347253.html 转载请保留说明!友情链接: 武汉网站建设