How to Fix MySQL Error 4066 (ER_CHANGE_REP_SOURCE_CANT_DISABLE_REQ_ROW_FORMAT_WITH_GTID_ONLY)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get mysql error 4066 when you turn off required row format while GTID-only mode is on. You fix it by keeping row format required or turning off GTID-only mode first. This problem happens when an admin updates replication source rules on a replica server. MySQL stops the change to protect data sync across your database cluster. Understanding how these two settings work together helps you avoid replication breaks. What causes mysql error 4066 in replication channels MySQL uses the symbol E

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 4066 when you turn off required row format while GTID-only mode is on. You fix it by keeping row format required or turning off GTID-only mode first.

This problem happens when an admin updates replication source rules on a replica server. MySQL stops the change to protect data sync across your database cluster. Understanding how these two settings work together helps you avoid replication breaks.

What causes mysql error 4066 in replication channels

MySQL uses the symbol ER_CHANGE_REP_SOURCE_CANT_DISABLE_REQ_ROW_FORMAT_WITH_GTID_ONLY and SQLSTATE HY000 for this alert. The server message states that REQUIRE_ROW_FORMAT cannot be disabled for a channel when GTID_ONLY=1. This rule exists because GTID-only mode depends on row-based binary logging to work.

When a channel uses GTID-only mode, the replica stops saving file positions in tables. It relies on global transaction identifiers to track data changes from the source. Row format requirement ensures that all events arriving in the stream are safe.

If you try to turn off the row format rule, the engine blocks it. Allowing statement-based events while in GTID-only mode can cause bad data drift. The database engine forces you to keep row format active whenever GTID-only is enabled.

How to diagnose the replication channel state

Before you change any replication rules, you must check the current channel setup. Look at your replica status tables to see which channels have GTID-only mode enabled. You should also check which channels enforce the row format rule right now.

Many teams hit this error when running automated scripts that update source settings. An older script might try to reset the row format flag by mistake. Checking the exact flags sent during the update will show the conflict right away.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Make sure you only use read roles when checking production status tables. You do not need full admin rights just to read replication channel settings. Limiting permissions during diagnosis keeps your live database safe from accidental writes.

How to fix the conflict safely in production

You have two safe ways to resolve this error on a live database replica. First, you must decide if your team truly needs to turn off row format. Most modern MySQL clusters work best with both GTID-only and row format turned on.

If you want to keep GTID-only mode, update your change script right away. Remove the part of the command that tries to disable the row format requirement. The update will then run cleanly while keeping all safety checks in place.

If you must turn off the row format rule, take a two-step approach. First, stop the replication channel so no new transactions arrive during your work. Next, turn off GTID-only mode and the row format rule in the same update.

Once the engine accepts the new rules, start the replication channel again. Check the replica logs to make sure data flows without any new errors. Always test these rule changes in a staging setup before touching production servers.

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 SQLSTATE HY000 mean for MySQL error 4066?

SQLSTATE HY000 is a general error code used by the MySQL database engine. You must read the specific error number 4066 to know the exact replication cause.

Can I turn off REQUIRE_ROW_FORMAT while replication is running?

No, you must stop the replication channel before changing these source settings. You also have to set GTID_ONLY to zero if you disable row format rules.

Does fixing error 4066 cause any data loss on the replica?

No, this error blocks an invalid setting change before it takes effect. Your existing data and replication stream stay safe while you fix the command.

The query runs. The emails stay hidden.