1624
MySQLWARNINGNotableReplicationHIGH confidence
Unsafe statement: non-transactional table written after transactional table in transaction
Production Risk
High — can cause permanent master/replica divergence.
What this means
Within the same transaction a non-transactional table (e.g., MyISAM) is written after a transactional table (e.g., InnoDB), creating a replication hazard when using STATEMENT mode.
Why it happens
- 1Mixing InnoDB and MyISAM writes in a single transaction.
- 2If the transaction is rolled back, the MyISAM write cannot be undone, causing master/replica divergence.
How to reproduce
trigger — this will error
trigger — this will error
BEGIN; INSERT INTO innodb_table VALUES (1); INSERT INTO myisam_table VALUES (1); ROLLBACK;
expected output
Warning 1624: Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.
Fix 1
Avoid mixing transactional and non-transactional tables in the same transaction
Avoid mixing transactional and non-transactional tables in the same transaction
-- Keep MyISAM writes outside InnoDB transactions
Why this works
Separating writes eliminates the mixed-engine transaction hazard.
Fix 2
Convert MyISAM tables to InnoDB
Convert MyISAM tables to InnoDB
ALTER TABLE myisam_table ENGINE = InnoDB;
Why this works
Using a single transactional engine removes the non-transactional write hazard.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 1624 ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev