1612
MySQLWARNINGNotableReplicationHIGH confidence

Unsafe statement with statement-only engine and STATEMENT binlog format

Production Risk

Medium — replication may produce inconsistent data on replicas.

What this means

A statement is unsafe for statement-based replication and uses a statement-only engine, making it impossible to log safely.

Why it happens
  1. 1A statement that is unsafe for SBR (e.g., uses UUID(), RAND(), or similar non-deterministic functions) is executed against a table using a statement-only storage engine.
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO myisam_table VALUES (UUID());

expected output

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

Fix

Convert the table to InnoDB and use ROW or MIXED format

Convert the table to InnoDB and use ROW or MIXED format
ALTER TABLE myisam_table ENGINE = InnoDB;
SET GLOBAL binlog_format = 'MIXED';

Why this works

ROW-capable engines with MIXED format can safely log non-deterministic statements.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 1612 ER_BINLOG_UNSAFE_AND_STMT_ENGINE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors