1716
MySQLERRORNotableAccess ControlHIGH confidence
Cannot set password expiration for anonymous user
Production Risk
Low — operation fails; no user changes occur.
What this means
Password expiration options cannot be applied to anonymous (nameless) MySQL accounts.
Why it happens
- 1Executing ALTER USER ''@'localhost' PASSWORD EXPIRE INTERVAL 90 DAY.
How to reproduce
trigger — this will error
trigger — this will error
ALTER USER ''@'localhost' PASSWORD EXPIRE INTERVAL 90 DAY;
expected output
ERROR 1716 (HY000): Cannot set password expiration for the anonymous user.
Fix
Remove anonymous accounts instead
Remove anonymous accounts instead
DROP USER ''@'localhost'; DROP USER ''@'%';
Why this works
Removing anonymous accounts is a security best practice and avoids this limitation.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 1716 ER_PASSWORD_EXPIRE_ANONYMOUS_USER
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev