How to Fix MySQL Error 1844 (ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get mysql error 1844 when a query touches both replicated and local tables. You can fix it by switching the binary log to row format or splitting the query. This problem stops your database from writing changes to the binary log. When the log uses statement mode, the engine cannot split one query into two parts. It refuses to run the statement so your replica nodes stay safe and match the source. What causes mysql error 1844 in the database engine The database engine uses the binary log

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 1844 when a query touches both replicated and local tables. You can fix it by switching the binary log to row format or splitting the query.

This problem stops your database from writing changes to the binary log. When the log uses statement mode, the engine cannot split one query into two parts. It refuses to run the statement so your replica nodes stay safe and match the source.

What causes mysql error 1844 in the database engine

The database engine uses the binary log to send data changes to replica servers. When you set the log format to statement mode, the server writes the raw query text. Every replica reads that exact query text and runs it against its own data.

In MySQL, error code 1844 maps to the internal symbol ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES and SQLSTATE HY000. The engine blocks the query because it cannot write the event to the binary log. This happens when statement mode is active and a query touches replicated and non-replicated tables together.

Some tables live only on the local server and do not go to replicas. You might set up filter rules that tell the engine to skip certain tables or schemas. Performance schemas or local scratch tables also stay off the replication stream by design.

Trouble starts when a single write statement reads from or writes to both table types. If the server logs the statement, the replica will fail because it lacks the local table. If the server skips the log, the replica misses changes meant for the shared table. To prevent broken data, the database stops the query right away and returns code 1844.

How to diagnose and fix the failure in production

First, find the exact query that failed in your app logs or database monitoring tool. Look at every table name inside that query, including tables inside joins or subqueries. Check your server replication rules to see which of those tables the binary log skips.

MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Next, check which binary log format your database server uses right now. Statement mode is old and causes many issues like this one when queries mix table types. Row mode records the actual changed rows instead of the raw SQL text. Mixed mode uses statement logging by default but switches to row logging when needed.

The safest fix in production is to change the binary log format to row mode. In row mode, the engine logs only the row changes for the replicated table. It ignores changes to the non-replicated table and does not throw an error. You do not need to grant extra user rights or turn off binary logging to do this.

If you must keep statement mode, you have to change how your app runs the query. Break the single statement into two separate queries in your app code. Read the data you need from the local table in the first step. Then run a second query that writes only to the replicated table.

How to prevent binary log format conflicts

Teams can avoid these errors by setting clear rules for database changes before release. Keep your test database log settings identical to your production server settings. If production uses statement mode, your staging servers must use statement mode too.

Review ad-hoc queries before developers run them against live production databases. Many incidents happen when an engineer joins a temporary local table with a live core table. Good query review habits catch these mixed-table writes before they hit the database engine.

Inspect every MySQL query and response in flight

Static grants and network rules block bad logins. They cannot pause a risky query for review or mask emails in a result set. By design, hoop.dev sits inline in the MySQL protocol as a sidecar for your MySQL. For every plain query, prepared statement, or cursor an agent or human runs in production, hoop.dev decides to pass, mask, block, or hold it for review.

First, hoop.dev guardrails block banned actions before MySQL runs them, and an AI Analyzer you configure can score intent or escalate for approval. Next, hoop.dev data masking rewrites sensitive string columns in results in memory, and every verdict goes to the audit trail. Find the open-source binary on GitHub.

Frequently asked questions

What does ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES mean?

It means a single query tried to use both replicated and non-replicated tables. Because the binary log is in statement mode, the database blocked the query to protect replication.

Does switching to row-based logging fix mysql error 1844?

Yes, switching the binary log to row mode fixes this error right away. Row mode logs individual row changes, so the engine skips local tables without blocking the query.

Can I turn off the binary log for my session to bypass this error?

You should not turn off binary logging for your session in production. Doing so requires high admin privileges and will cause your replica servers to miss data updates.

The query runs. The emails stay hidden.