MySQL:Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT...

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

时间: 2024-08-29 02:07:05

MySQL:Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT...的相关文章

Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.

一.问题描述  014-12-15 20:00:29 4398 [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE  on a table with more than one UNIQUE KEY is unsafe Statement: INSERT INTO 

JAVA调用mysql数据操作时出现错误:impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT.'

使用mysql做持久化报错:Cannot execute statement: impossible to write to binary log since BINLOG_FORM ActiveMQ中如果使用mysql innodb的同时,开启了binlog,那么在ack消息的时候,日志里就可会报错:java.sql.SQLException: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATE

Mysql:Changes in MySQL 5.7.7 (2015-04-08, Release Candidate):The innodb_file_format default value was changed to Barracuda

Changes in MySQL 5.7.7 (2015-04-08, Release Candidate) Functionality Added or Changed Important Change; InnoDB: The following changes were made to InnoDB configuration option default values: The innodb_file_format default value was changed to Barracu

MySQL 二进制日志(Binary Log)

同大多数关系型数据库一样,日志文件是MySQL数据库的重要组成部分.MySQL有几种不同的日志文件,通常包括错误日志文件,二进制日志,通用日志,慢查询日志,等等.这些日志可以帮助我们定位mysqld内部发生的事件,数据库性能故障,记录数据的变更历史,用户恢复数据库等等.二进制日志,也叫binary log,是MySQL Server中最为重要的日志之一,本文主要描述二进制日志. 1.MySQL日志文件系统的组成   a.错误日志:记录启动.运行或停止mysqld时出现的问题.   b.通用日志:

MySQL学习笔记06基于Binary Log的复制

1.1.1. 相关概念 (1)Binary Log 当变量log_bin的值为ON时,MySQL将启用Binary Log,这将在data目录下产生类似mysql-bin.00001, mysql-bin.00002的二进制日志文件,这些文件记录了数据库中执行的各种操作. binlog_format变量指定了MySQL的二进制日志的格式,支持三种类型的格式: ROW       使用数据表的行记录来记录日志.优点是避免了STATEMENT格式时SQL语句中自增字段的不良影响.缺点时一条更新大量记

binary log初探

binary log是mysql中一个重要的部分,主要作用有两个: Replication:在master端开启binary log后,log会记录所有数据库的改动,然后slave端获取这个Log文件内容就可以在slave端进行同样的操作. 备份:在某个时间点a做了一次备份,然后利用binary log记录从这个时间点a后的所有数据库的改动,然后下一次还原的时候,利用时间点a的备份文件和这个binary log文件,就可以将数据还原. 与binary log相关的参数如下: log-bin和lo

手动创建binary log files和手动编辑binary log index file会有什么影响

一.了解Binary Log结构 1.1.High-Level Binary Log Structure and Contents • Binlog包括binary log files和index file• 每个binary log文件的前4字节是Magic Number,紧接着是一组描述数据修改的Events • The magic number bytes are 0xfe 0x62 0x69 0x6e = 0xfe 'b''i''n' • 每个Event包括header bytes和da

ActiveMQ中使用mysql做持久化报错:Cannot execute statement: impossible to write to binary log since BINLOG_FORM

ActiveMQ中如果使用mysql innodb的同时,开启了binlog,那么在ack消息的时候,日志里就可会报错:java.sql.SQLException: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited

Mysql:FAQ:A.14 Replication

A.14 MySQL 5.7 FAQ: Replication In the following section, we provide answers to questions that are most frequently asked about MySQL Replication. A.14.1. Must the slave be connected to the master all the time? A.14.2. Must I enable networking on my m