impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a stor

Posted wang-yaz

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a stor相关的知识,希望对你有一定的参考价值。

执行jdbc查询时抛出异常:

Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.

 

原因及解决方案

This is required by mysql:

Statement based binlogging does not work in isolation level
READ UNCOMMITTED and READ COMMITTED since the necessary
locks cannot be taken.

根据tomcat抛异常,提示是事务级别在read committed和read uncommitted的时候binlog必须设置为row格式。

这个是java设置的一个局限性,java默认的事务级别是read committed,而mysql默认设置的binlog_format=statement。

将binlog_format设置为mixed

set global binlog_format=mixed;

过段时间,异常仍在!

设置成row

set global binlog_format=row;

问题解决!

或:

mysql> SET SESSION binlog_format = ‘ROW‘;

mysql> SET GLOBAL binlog_format = ‘ROW‘;

注意: 若手动修改linux下面/etc/my.cnf :  binlog_format = row  ,  需要重启mysql。

 

以上是关于impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a stor的主要内容,如果未能解决你的问题,请参考以下文章

Client requested master to start replication from impossible position; the last event was read from(

错误记录Kotlin 编译报错 ( Smart cast to ‘Xxx‘ is impossible, because ‘xxx‘ is a mutable property ... )

How to write threats to validity?

英语给某人写信三种说法1,write to sb 另两种

3 Ways to Write Text to a File in Python

write_to_file