mysql执行sql提示ERROR 1665 (HY000)
将隔离级别设置为READ UNCOMMITTED后,执行sql提示ERROR 1665 (HY000)
这是linux下修改隔离级别之后出现的问题,windows下修改隔离级别后没有问题,而且binlog模式是statement
mysql> SELECT @@tx_isolation;
+------------------+
| @@tx_isolation |
+------------------+
| READ-UNCOMMITTED |
+------------------+
1 row in set (0.00 sec)
mysql> delete from linelock where id = 4;
ERROR 1665 (HY000): 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.
mysql>
【报错原因】
innodb的事务隔离级别是read commited或者read uncommited模式时,binlog不可以使用statement模式。
【解决办法】
方法1:不重启mysql服务
set global binlog_format=mixed
重新建立的会话中BINLOG_FORMAT会变为mixed模式。
参考mysql错误处理之ERROR 1665 (HY000)
方法2:重启mysql服务
把my.cnf中binlog_format改为混合模式:
# binary logging format - mixed recommended
binlog_format=mixed
参考ERROR 1665 (HY000): Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT