MySQL binlog_format异常 博客分类: MySQL mysqlbinlog_format
环境
tomcat 6.x
jdk 1.6
mysql5.5
异常
执行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。
推荐阅读
-
MySQL binlog_format异常 博客分类: MySQL mysqlbinlog_format
-
Java链接MySQL数据库 博客分类: JavaMySQL mysqljavadatabase数据库
-
Linux下C++连接操作MySQL数据库环境搭建 博客分类: c/c++LinuxMySQL c/c++LinuxMySQLgccboost
-
Java链接MySQL数据库 博客分类: JavaMySQL mysqljavadatabase数据库
-
mysql problems 博客分类: Problems mysqlmysql problems
-
Hibernate3保持数据到MySQL乱码问题 博客分类: Hibernate技术
-
RedHat下安装MySQL5.5 博客分类: LinuxMySQL linuxredhatmysql
-
MySQL命令大全(转载) 博客分类: MySQL数据库 mysqlcommand
-
PostgreSQL与MySQL区别 博客分类: mysql 占用
-
mysql慢sql分析,性能优化 博客分类: mysql