Common SQL Errors

MySQL Error 1844: ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES - How to Fix and Prevent

Galaxy Team
August 7, 2025

<p>Error 1844 is raised when STATEMENT-based binary logging tries to write to both replicated and non-replicated tables in the same statement.</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 code 1844 (ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES)?

<p>MySQL Error 1844: ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES appears when STATEMENT binlog_format meets a query touching both replicated and filtered tables. Switch binlog_format to ROW or split the statement to fix the issue.</p>

Error Highlights

Typical Error Message

Cannot execute statement: impossible to write to binary

Error Type

Replication / Binary Logging Error

Language

MySQL

Symbol

ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES

Error Code

1844

SQL State

HY000

Explanation

Table of Contents

What does MySQL Error 1844 mean?

Error 1844 fires when MySQL is running in STATEMENT binlog_format and a single DML statement targets tables that replication filters mark differently. Because the statement cannot be replayed safely on replicas, MySQL blocks execution.

The error text reads: "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT, and both replicated and non replicated tables are written to."

When does the problem usually surface?

The error often appears after enabling --replicate-do-table or --replicate-ignore-table on replicas. Any UPDATE, INSERT, DELETE, or MERGE touching both allowed and filtered tables in one statement will trigger the failure on the primary.

Multi-table statements, triggers referencing other schemas, and complex joins are common culprits because they silently mix table scopes.

Why does STATEMENT format block mixed statements?

With STATEMENT logging, the same SQL text is replayed on replicas. If replicas do not have all referenced tables or filters skip some, data divergence occurs. MySQL therefore refuses to log the statement to protect data integrity.

How can you resolve Error 1844 quickly?

Most teams switch to ROW binlog_format, which records individual row events and ignores replication filters safely. Alternatively, split the offending statement into two transactions that each touch only replicated or only non-replicated tables.

What long-term practices prevent the error?

Standardize on ROW or MIXED binlog_format in production, audit replication filter rules during schema reviews, and add CI checks to flag cross-schema DML. Galaxy’s linting engine can surface mixed-table writes before they hit production.

Common Causes

Replication filter mismatch

replicate-do-table or replicate-wild-do-table includes one table in the statement, while another table is excluded, creating a conflict.

Use of STATEMENT binlog_format

The server is configured with BINLOG_FORMAT=STATEMENT, which cannot serialize safe mixed-table operations.

Triggers or cascades touching filtered tables

A trigger on a replicated table updates a non-replicated table, unintentionally mixing scopes.

Cross-schema DML

Statements that join or update tables across databases, where one database is filtered out of replication, trigger the error.

Related Errors

MySQL Error 1785: ER_BINLOG_ROW_MODE_AND_STMT_ENGINE

Raised when ROW format meets a storage engine that only supports statement logging.

MySQL Error 1665: ER_BINLOG_UNSAFE_STATEMENT

Occurs when a statement considered unsafe for STATEMENT logging is attempted.

MySQL Error 1317: ER_QUERY_INTERRUPTED

Not replication specific but often appears after aborted mixed-table operations.

FAQs

Can I disable binary logging for one statement?

Yes. Issue SET sql_log_bin = 0 before the statement and SET sql_log_bin = 1 afterward. This suppresses the binary log but should be used only for non-critical local data.

Is MIXED format enough to avoid Error 1844?

MIXED chooses STATEMENT when safe and ROW when needed. In nearly all mixed-table scenarios it will switch to ROW and prevent the error.

Will adding the missing table on replicas fix the issue?

If the table is meant to replicate, adding it and removing exclude filters can resolve the error. Otherwise switch to ROW or split the statement.

How does Galaxy help catch this error?

Galaxy’s SQL editor highlights replication filters and lint rules. It flags queries that join filtered and unfiltered tables, helping teams fix issues 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