How to Fix MySQL Error 3006 (ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN)

Published
Length
4 min read

Luis Felipe Dias

All posts

You see mysql error 3006 when a write query uses a custom fulltext parser plugin. You fix it by switching the binary log format from statement mode to row mode. MySQL flags this alert with the symbol ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN and the SQLSTATE code HY000. The official message warns that a statement is unsafe because it uses a fulltext parser plugin. That plugin may not return the same value on the replica server. When a write query relies on a fulltext search, the plugin parses the text.

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 see mysql error 3006 when a write query uses a custom fulltext parser plugin. You fix it by switching the binary log format from statement mode to row mode.

MySQL flags this alert with the symbol ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN and the SQLSTATE code HY000. The official message warns that a statement is unsafe because it uses a fulltext parser plugin. That plugin may not return the same value on the replica server.

When a write query relies on a fulltext search, the plugin parses the text. If two servers have different plugin setups, they might change different rows. This risk causes the database engine to warn you or block the query.

Root causes of mysql error 3006 in database clusters

This problem starts in the binary log setup of your source database. MySQL uses the binary log to send data changes from the source to replicas. It can record these changes as raw SQL statements or as changed rows.

Statement mode logs the exact SQL text that your app ran. The replica reads that SQL text and runs the query all over again. This approach works only when every function returns the exact same output everywhere.

Fulltext parser plugins break this rule because they depend on local server state. A parser plugin breaks text into words based on custom logic and stopword files. The source server and the replica server might have different plugin versions.

They might also use different character sets or local dictionary files on disk. If an update or insert query uses a fulltext search, the results can drift. The source might update five rows while the replica updates only three rows.

Silent data drift breaks cluster health and ruins your backup integrity. To prevent this issue, the engine marks fulltext plugin queries as unsafe for statement logging. If your server blocks unsafe statements, the query fails right away with error 3006.

How to diagnose and fix the failure in production

First, check your database error logs and slow query logs to find the query. Look for write queries that combine data changes with a fulltext match clause. Read queries alone do not write to the binary log or trigger this code.

Next, check the active binary log mode on your source and replica servers. You will see that the session or global setting uses statement logging. Do not fix this by turning off binary logging or lowering safety checks.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Turning off logs breaks point-in-time recovery and stops replication to read nodes. Do not grant broad admin roles to app accounts so they can change session modes. Giving extra rights to an app user creates a huge security risk.

The safe fix is to switch your database cluster to row-based binary logging. In row mode, the source server runs the fulltext plugin and finds the matching rows. It then writes the exact row changes to the binary log.

The replica receives the final row data and applies it without running the plugin. Both servers keep the exact same data, even if their plugin files differ. Mixed mode is another safe option for teams that prefer statement logs by default.

In mixed mode, the engine uses statement logging for safe queries. When it sees a query with a fulltext parser plugin, it switches to row mode. You can also split the query in your app code as a permanent fix.

Run a read query with the fulltext plugin first to get the primary keys. Then run a second write query that updates those rows by their exact primary keys. Primary key updates are always safe and never trigger plugin warnings in the log.

Preventing replication drift across database nodes

Good change control keeps your source and replica servers in sync over time. Even with row mode active, you should keep plugin versions identical across all nodes. A replica might become a source node during a failover event.

If that new source has an old plugin file, your app queries will return odd results. Use automated deploy tools to push the same plugin files to every database host. Check your replica status often to catch any replication lag or broken threads early.

Restrict who can change binary log settings or install plugins on production hosts. Only senior database admins should run commands that alter replication modes. Review all database admin actions in a central log to keep your data safe.

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

Does mysql error 3006 stop my query or just log a warning?

It depends on your server rules and transaction modes. By default, statement mode logs a warning and still runs the query. If your server enforces strict replication consistency, it blocks the query and returns an error.

Can a simple read query trigger ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN?

No, plain read queries do not write to the binary log. This issue only happens when a fulltext parser plugin runs inside a query that changes data. Examples include insert, update, delete, or create table statements that use fulltext matching.

Why is mixed binary logging safe for fulltext parser plugins?

Mixed logging checks each query before writing to the binary log. When it detects an unsafe fulltext plugin call, it records that specific change in row format. The replica then applies the exact row changes without running the plugin again.

The query runs. The emails stay hidden.