1641
MySQLWARNINGNotableReplicationHIGH confidence
Statement accesses both transactional and a self-logging non-transactional engine
Production Risk
Medium — replica may diverge if the transaction is rolled back.
What this means
A statement writes to both a transactional engine (InnoDB) and a self-logging non-transactional engine in the same statement, creating a replication hazard.
Why it happens
- 1Mixing InnoDB and MyISAM (or another self-logging engine) in the same DML statement.
- 2The non-transactional engine logs writes immediately, independent of the transaction outcome.
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO innodb_t SELECT * FROM myisam_t;
expected output
Warning 1641: Unsafe statement written to the binary log.
Fix 1
Separate writes to different engines into independent statements
Separate writes to different engines into independent statements
-- Write to InnoDB and MyISAM in separate statements outside a shared transaction
Why this works
Isolation prevents mixed-engine logging hazards.
Fix 2
Convert non-transactional tables to InnoDB
Convert non-transactional tables to InnoDB
ALTER TABLE myisam_t ENGINE = InnoDB;
Why this works
Using a single transactional engine eliminates the mixed-engine problem.
Sources
Official documentation ↗
MySQL 8.0 — 1641 ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev