How to Fix MySQL Error 3896 (ER_PARTIAL_REVOKES_EXIST)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see mysql error 3896 when you try to turn off the partial revokes setting while database restrictions still exist. To fix it, you must remove all partial revokes from user accounts or keep the partial revokes variable turned on. MySQL logs this failure under the symbol ER_PARTIAL_REVOKES_EXIST and SQLSTATE HY000. The engine blocks your change to stop users from gaining wide access by mistake. Understanding how partial revokes work helps your team fix the issue without risking data safety.

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 3896 when you try to turn off the partial revokes setting while database restrictions still exist. To fix it, you must remove all partial revokes from user accounts or keep the partial revokes variable turned on.

MySQL logs this failure under the symbol ER_PARTIAL_REVOKES_EXIST and SQLSTATE HY000. The engine blocks your change to stop users from gaining wide access by mistake. Understanding how partial revokes work helps your team fix the issue without risking data safety.

What causes mysql error 3896 in your database

MySQL lets database admins grant broad global rights to a user role or account. At the same time, admins can block rights on one or more specific schemas. MySQL calls this type of restriction a partial revoke.

The database tracks these rules inside the internal user grant tables. When the partial revokes system variable is on, the engine checks these schema blocks during every query. If an admin tries to turn that system variable off, MySQL checks the grant tables first.

If even one account still has a schema restriction, the engine stops the change. It returns the message that at least one partial revoke exists on a database. It also states that the partial revokes system variable must stay set to on.

This check is a core safety guardrail in the database engine. Turning off the feature while restrictions exist would erase those schema blocks right away. Users with global rights would gain full power over sensitive schemas that were blocked before.

How to find active partial revokes in MySQL

Before you change the system setting, you must find which accounts hold partial revokes. Database admins can read the internal user table inside the system schema to check user attributes. MySQL stores partial revoke rules as structured data inside the user attributes column.

You can also check the grant list for each admin and app user account. Look for revoke statements that apply to a single schema alongside global grants. Make a complete list of every user account and schema pair that relies on these blocks.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Check with your security team before you change any of these accounts. Often, an admin added a partial revoke to protect system tables or private customer records. Removing the rule without a backup plan can expose private data like emails or card numbers.

How to fix the error safely in production

You have two safe ways to resolve this error in a live setup. The safest choice is to leave the partial revokes system variable turned on. This keeps all current schema blocks active and requires no changes to user roles.

If you must turn off the setting, you have to clean up the accounts first. Start by replacing global grants on those accounts with specific schema grants. Give each user access only to the exact databases they need for their work.

Next, clear the partial revoke rules from those user accounts. You can do this either by granting the blocked schema rights back or by revoking the global rights. Once you remove the global rights, the schema restriction is no longer needed.

After you clear every partial revoke, check the system user table one more time. Confirm that no restriction records remain on any user account in the cluster. You can now turn off the partial revokes system variable without triggering the error.

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_PARTIAL_REVOKES_EXIST mean in MySQL?

It means at least one user account has a schema restriction on a global grant. MySQL blocks you from turning off the partial revokes setting until you remove that restriction.

Will turning off partial revokes drop my database tables?

No, changing this setting never deletes tables or rows in your database. Still, MySQL blocks the change so users do not gain unwanted access to restricted schemas.

How do I remove a partial revoke from a MySQL user?

You can remove a partial revoke by granting the restricted schema right back to the user. You can also revoke the user's global privilege and grant rights per schema instead.

The query runs. The emails stay hidden.