Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and a...

在实现数据库主备同步的时候,java.sql.SQLException。

Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and a..._第1张图片
image.png

mysql默认的binlog_format是STATEMENT。

从 MySQL 5.1.12 开始,可以用以下三种模式来实现:基于SQL语句的复制(statement-based replication, SBR),基于行的复制(row-based replication, RBR),混合模式复制(mixed-based replication, MBR)。

binlog的格式也有三种:STATEMENT,ROW,MIXED。

解决方法:

仅一次性解决:

mysql> STOP SLAVE;
Query OK, 0 rows affected (0.02 sec)

mysql>  SET GLOBAL binlog_format=ROW;
Query OK, 0 rows affected (0.00 sec)

mysql> START SLAVE;
Query OK, 0 rows affected (0.00 sec)

永久解决

修改my.ini配置

# binary logging format - ROW
binlog_format=ROW

你可能感兴趣的:(Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and a...)