Common SQL Errors

MySQL Error 1675: ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS - Causes, Fixes, and Prevention

Galaxy Team
August 7, 2025

<p>The statement mixes transactional and non-transactional tables in one transaction, making the binary log entry unsafe for replication.</p>

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1675?

<p>MySQL Error 1675: ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS occurs when a single transaction reads or writes transactional tables (InnoDB) and then writes to a non-transactional table (MyISAM). MySQL marks the statement unsafe for row-based replication and stops execution. Separate the operations or convert the non-transactional table to InnoDB to resolve the issue.</p>

Error Highlights

Typical Error Message

Statement is unsafe because it accesses a

Error Type

Replication Safety Error

Language

MySQL

Symbol

ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS

Error Code

1675

SQL State

HY000

Explanation

Table of Contents

What is MySQL Error 1675 ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS?

The error appears when a transaction that has already accessed a transactional table then tries to access a non-transactional table. MySQL flags the statement as unsafe because the binary log cannot guarantee atomicity across different storage engines.

When does it occur?

It surfaces during row-based or mixed replication modes, or when binlog_format=STATEMENT and the optimizer spots potential data drift between master and replica.

Why is it critical to fix?

Ignoring the warning risks silent replication inconsistencies, data loss, or slave divergence, especially in high-availability clusters.

What Causes This Error?

Mixing InnoDB and MyISAM inside one explicit transaction triggers the safeguard. MySQL cannot roll back the MyISAM part if the InnoDB part fails, so it blocks the statement.

How to Fix MySQL Error 1675

Convert non-transactional tables to InnoDB, split the logic into separate autocommit statements, or wrap only transactional tables in START TRANSACTION while handling non-transactional tables afterward.

Common Scenarios and Solutions

Legacy reporting tables in MyISAM updated after OLTP writes often raise the error. Converting those tables or moving updates to a separate connection eliminates it.

Best Practices to Avoid This Error

Standardize on a transactional engine, audit mixed-engine transactions in CI, and enable MySQL strict mode to catch unsafe patterns early.

Related Errors and Solutions

Error 1671 (ER_BINLOG_UNSAFE_AUTOCOMMIT) warns about unsafe autocommit statements. The fix is similar: restructure or change engine types.

Common Causes

Mixed Storage Engines

Running UPDATE or INSERT on a MyISAM table after touching an InnoDB table inside the same transaction.

Legacy MyISAM Logging Tables

Audit or log tables created before engine unification often remain MyISAM and get updated in large transactions.

Triggers and Stored Procedures

Triggers that write to non-transactional tables while the caller operates on transactional tables silently create unsafe binlog sequences.

Related Errors

Error 1671 ER_BINLOG_UNSAFE_AUTOCOMMIT

Raised when autocommit statements are unsafe for replication; solved by using row-based format or restructuring queries.

Error 1672 ER_BINLOG_UNSAFE_SYSTEM_FUNCTION

Occurs when non-deterministic functions are used in statements logged in statement mode; fix by switching to row-based logging.

Error 1888 ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT

Signals potentially unsafe INSERT IGNORE ... SELECT operations; solved by rewriting the query or using row-based format.

FAQs

Can I safely ignore Error 1675?

No. Proceeding can cause replication drift. Always restructure the transaction or change table engines.

Does row-based logging remove the error?

Row-based format reduces many unsafe cases but MySQL still blocks mixed-engine transactions to protect data integrity.

Is MyISAM the only engine that triggers Error 1675?

Any non-transactional engine, including ARCHIVE or CSV, can trigger it after transactional access.

How does Galaxy help?

Galaxy flags mixed-engine statements during query review and suggests engine conversion commands, preventing the error before deployment.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo