3387
MySQLERRORNotableAccess ControlHIGH confidence

Role not found

Production Risk

Low — GRANT or REVOKE fails; no change occurs.

How to reproduce
trigger — this will error
trigger — this will error
GRANT nonexistent_role TO 'user'@'localhost';

expected output

ERROR 3387 (HY000): Role 'nonexistent_role'@'%' does not exist.

Fix

Create the role first

Create the role first
CREATE ROLE nonexistent_role; GRANT nonexistent_role TO 'user'@'localhost';

Why this works

The role must exist before it can be granted.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3387 ER_ROLE_NOT_FOUND

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

← All MySQL errors