3391
MariaDBERRORNotableAccess ControlHIGH confidence

Cannot revoke a mandatory role from user

Production Risk

Low — REVOKE fails; no change occurs.

How to reproduce
trigger — this will error
trigger — this will error
REVOKE mandatory_role FROM 'user'@'localhost';

expected output

ERROR 3391 (HY000): Cannot revoke mandatory role.

Fix

Remove role from mandatory_roles first

Remove role from mandatory_roles first
SET PERSIST mandatory_roles = ''; REVOKE mandatory_role FROM 'user'@'localhost';

Why this works

Once the role is no longer mandatory, it can be revoked from individual users.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3391 ER_USER_IS_MANDATORY_ROLE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors