MySQL:Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEM

作者:mdxy-dxy 时间:2024-01-27 16:55:14 

1:错误日志大量错误

150602 14:40:02 [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配置问题,大家可以参考这篇文章:https://www.jb51.net/article/84357.htm

标签:MySQL,Unsafe,statement
0
投稿

猜你喜欢

  • JavaScript Math 对象常用方法总结

    2024-06-05 09:33:56
  • 基于Python实现绘制属于你的世界地图

    2021-11-30 16:55:50
  • php获取当前页面完整URL地址

    2024-05-13 09:20:56
  • 机器学习python实战之手写数字识别

    2021-06-29 03:07:07
  • 《色彩解答》系列之二 色彩比例

    2008-02-17 14:38:00
  • 老生常谈Python中的Pickle库

    2023-07-19 19:31:03
  • Python中切片的详细操作篇

    2021-11-29 13:33:26
  • 浅谈PHP错误类型及屏蔽方法

    2023-11-23 10:26:46
  • 全面解析Bootstrap表单使用方法(表单样式)

    2024-05-10 14:08:28
  • 对numpy Array [: ,] 的取值方法详解

    2023-02-05 17:33:23
  • NumPy索引与切片的用法示例总结

    2022-05-13 19:33:38
  • Python中的with...as用法介绍

    2023-03-30 11:17:19
  • linux mysql5.5升级至mysql5.7的步骤与踩到的坑

    2024-01-21 17:09:08
  • jupyter notebook oepncv 显示一张图像的实现

    2022-03-26 20:09:19
  • 写一个Python脚本自动爬取Bilibili小视频

    2022-04-29 04:10:48
  • Python基于TensorFlow接口实现深度学习神经网络回归

    2022-07-17 22:38:28
  • Web UI 设计(网页设计)命名规范

    2009-05-13 13:06:00
  • python类中super() 的使用解析

    2022-12-02 09:08:10
  • Omi v1.0.2发布正式支持传递javascript表达式

    2024-04-19 11:03:04
  • Python实现约瑟夫环问题的方法

    2021-09-07 19:41:28
  • asp之家 网络编程 m.aspxhome.com