时间:2021-05-23
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配置问题,大家可以参考这篇文章:
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
nginx日志相关指令主要有两条,log_format,用来设置日志格式,access_log,用来指定日志文件的存放路径、格式和缓存大小log_format格
MySQL获取当前日期及日期格式获取系统日期:NOW()格式化日期:DATE_FORMAT(date,format)注:date:时间字段format:日期格式
MYSQL获取当前日期及日期格式获取系统日期:NOW()格式化日期:DATE_FORMAT(date,format)注:date:时间字段format:日期格式
Statement对象是用来执行SQL语句的PreparedStatement:预编译的Statement对象,是Statement的子接口。一.性能和代码编写
一、开启binlog。首先查看binlog是否开启mysql>showvariableslike"log_bin";+---------------+-----