3629
MySQLERRORNotableAccess ControlHIGH confidence

Authentication factor not allowed for anonymous user

Production Risk

Low — ALTER USER fails; anonymous account is unchanged.

How to reproduce
trigger — this will error
trigger — this will error
ALTER USER ''@'%' ADD 2 FACTOR IDENTIFIED WITH authentication_fido;

expected output

ERROR 3629 (HY000): Authentication factor cannot be set for anonymous user.

Fix

Use a named account for MFA

Use a named account for MFA
CREATE USER 'secure_user'@'%' IDENTIFIED WITH caching_sha2_password BY 'pass';
ALTER USER 'secure_user'@'%' ADD 2 FACTOR IDENTIFIED WITH authentication_fido;

Why this works

Creates a named account that supports MFA configuration.

What not to do

Version notes

Sources
Official documentation ↗

MySQL 8.0 — 3629 ER_AUTHENTICATION_FACTOR_FOR_ANONYMOUS_USER

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

← All MySQL errors