How to Fix MySQL Error 1675 (ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS)
You get mysql error 1675 when a single transaction reads or writes a transactional table and then a non-transactional table. You fix it by splitting the work into two transactions or converting the old tables to a transactional engine. The official symbol for this failure is ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS under SQLSTATE HY000. The engine warns you that the statement is unsafe for statement-based binary logging. When a rollback happens, the two table types behave in very different ways. T
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You get mysql error 1675 when a single transaction reads or writes a transactional table and then a non-transactional table. You fix it by splitting the work into two transactions or converting the old tables to a transactional engine.
The official symbol for this failure is ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS under SQLSTATE HY000. The engine warns you that the statement is unsafe for statement-based binary logging. When a rollback happens, the two table types behave in very different ways. This mismatch can leave your replica servers out of sync with the primary database.
Why mysql error 1675 happens in your database
MySQL supports multiple storage engines within the same database schema. Modern tables use a transactional engine that supports full rollbacks. Older or special tables might use a non-transactional engine that writes changes right away.
When you use statement-based binary logging, the database records the exact query text. Replicas read this log and run the same queries in the same order. Problems start when a transaction touches a transactional table first and a non-transactional table second.
The transactional engine holds its changes in memory until the transaction commits. The non-transactional engine writes its changes to disk right away. It also writes that change to the binary log before the transaction finishes. If another session reads the tables or if the transaction rolls back, the log order breaks. The primary server undoes the transactional part, but the non-transactional write stays on disk. Replicas that replay the log can end up with different data than the primary server.
How to diagnose the affected tables
First, find which queries trigger the warning or failure in your database logs. Look for transactions that join or update several tables at once. Next, check the storage engine for every table in that transaction.
Teams often find that one legacy table still uses an old engine. Temporary tables or audit log tables are also common culprits here. Do not grant broad admin roles to developers just to inspect table metadata. Give your team read-only access to the system schema views instead. This lets engineers check table engines without risking changes to production settings.
Protocol Translation (SAML to OIDC) + MySQL Access Governance: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
How to fix the error safely in production
You have three safe ways to resolve this issue without turning off safety checks. The best long-term fix is to convert the non-transactional table to a transactional engine. Once every table in the transaction uses the same engine, the error stops. Test this table change in a staging setup first to check app speed.
If you cannot change the table engine, change how the app runs the queries. Move the non-transactional write out of the main transaction block. Run it as a separate query after the main transaction commits. This keeps the binary log order clean and predictable.
You can also switch your binary log format from statement mode to row mode or mixed mode. Row-based logging records the actual row changes instead of the query text. In mixed mode, the database switches to row logging on its own when it spots an unsafe query. Never silence the error by turning off binary logging on production servers. That breaks backups and replica sync.
Check MySQL queries and results on the wire
MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.
Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.
Frequently asked questions
What does ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS mean?
It means a single transaction touched a transactional table first and a non-transactional table second. This order is unsafe when your server uses statement-based binary logging.
Does switching to row-based binary logging stop mysql error 1675?
Yes, row-based and mixed logging formats handle mixed engine writes without throwing this statement error. Still, a rollback still cannot undo changes made to the non-transactional table.
Can I ignore this warning if I do not use replicas?
No, you should still fix the root cause in your schema or app code. Even without replicas, a failed transaction leaves partial writes in your non-transactional tables. You also need clean binary logs for point-in-time recovery from backups.
Related guides
In this post