How to Fix MySQL Error 1884 (ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_GTID_GROUP)
You get mysql error 1884 when a single query must write to the binary log as multiple parts. To fix it, split the single command into separate steps so each part gets its own transaction tag. This failure uses the symbol ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_GTID_GROUP and returns SQLSTATE HY000. The database blocks the command because strict transaction rules do not allow one tag for split log entries. What causes mysql error 1884 in your database Databases use global transaction 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 1884 when a single query must write to the binary log as multiple parts. To fix it, split the single command into separate steps so each part gets its own transaction tag.
This failure uses the symbol ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_GTID_GROUP and returns SQLSTATE HY000. The database blocks the command because strict transaction rules do not allow one tag for split log entries.
What causes mysql error 1884 in your database
Databases use global transaction tags to track changes across primary and replica servers. Each change needs one unique tag in the binary log to keep data in sync. When you turn on strict consistency rules, the engine checks every command before it runs.
Some commands try to change two different table types at the same time. Other commands build a table and fill it with rows in one single step. The database engine must split these complex commands into two separate binary log events.
When a session already holds a fixed transaction tag, the engine cannot make a second tag. It refuses to run the query and throws mysql error 1884 right away. This stop prevents your replica servers from getting out of sync or losing data.
How to find the failing query in production
Start by checking your app error logs to find the exact query that failed. Look for scripts that build tables from query results or mix storage engines in one action. Backup restoration scripts and migration tools often trigger this specific failure during deployment.
Next, check the session state for the app user or migration tool. See if the client sets a manual transaction tag before it sends the query. This often happens when a team replays binary log files onto a live cluster.
MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Do not give your app user super admin rights just to bypass the check. Do not turn off global transaction tracking on a live cluster to make the script pass. Turning off these safety rules puts your replica servers at high risk of drift.
How to fix the error and keep data safe
The safest fix is to break the failing command into two separate steps. If a command builds a table and inserts rows at once, split those actions apart. First, run a statement that only builds the empty table structure in the database.
Second, run a standard insert command to load the needed rows into that new table. Each command now gets its own unique transaction tag in the binary log. The database writes both parts cleanly, and replica servers apply them in the right order.
If the error happens during a multi-table delete or update, check the storage engines. Make sure all tables in that query use the same transactional storage engine. If you must change both transactional and non-transactional tables, update each table in its own separate query.
Finally, if you are replaying logs with explicit tags, let the server assign tags instead. Reset the session tag rule to automatic before you run any complex schema changes. Test the updated script on a staging copy to confirm the binary log stays clean.
Add wire guardrails and masking beside MySQL
Database grants and TLS setup decide who can reach MySQL. Even so, an open session can run broad updates or read raw personal data from allowed tables. In practice, hoop.dev sits inline in the wire protocol beside the database as a sidecar for your MySQL. On every production query an agent or engineer sends, hoop.dev decides to pass, mask, block, or escalate it for human review.
With hoop.dev MySQL support, guardrails refuse bad queries before they run or hold risky calls for approval, while data masking rewrites matched sensitive values in result rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for GDPR, HIPAA, and PCI DSS programs. Read the docs and source on GitHub.
Frequently asked questions
What does ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_GTID_GROUP mean?
This symbol means your query must split into multiple binary log parts to run. Because your session uses a single transaction tag, the engine blocks the split to protect replication.
Can I fix mysql error 1884 by turning off binary logging?
No, turning off binary logging in production breaks replication and stops point-in-time recovery. Always fix the issue by splitting the complex query into smaller, separate commands instead.
Why did this query work before we turned on GTID mode?
Standard log positions allow one query to write multiple events without strict tag checks. Global transaction mode requires a strict one-to-one match between a transaction tag and a log group.
Related guides
In this post