3385
MariaDBERRORNotableAccess ControlHIGH confidence

Circular role grant detected

Production Risk

Low — GRANT fails; no role relationship is created.

How to reproduce
trigger — this will error
trigger — this will error
GRANT role_b TO role_a; GRANT role_a TO role_b;

expected output

ERROR 3385 (HY000): Circular role grant detected.

Fix

Flatten role hierarchy to remove cycle

Flatten role hierarchy to remove cycle
REVOKE role_b FROM role_a; GRANT role_b TO 'user'@'localhost'; GRANT role_a TO 'user'@'localhost';

Why this works

Assigning both roles directly to the user avoids hierarchical cycles.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3385 ER_GRANT_ROLE_LOOP

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

← All MariaDB errors