DBAtlas · Database operations atlas

1045: Access denied for user (using password: YES/NO)

MySQL

What does it mean?

Authentication failed for the user name, password or the host you are connecting from; the login was rejected.

Why does it happen?

Wrong password, the user has no privileges from the host it connects from (user@host), the account does not exist, an authentication plugin mismatch (caching_sha2_password vs mysql_native_password) or stale credentials in the connection string.

How to fix it

Check the user and host match: SELECT user, host, plugin FROM mysql.user. Grant privileges for the correct host (e.g. 'app_user'@'%'). Reset the password: ALTER USER 'app_user'@'host' IDENTIFIED BY 'new_password'; (ALTER USER/GRANT take effect immediately; FLUSH PRIVILEGES is needed only if the grant tables were modified directly with DML). If you see 'using password: NO', the client is not sending a password at all. For plugin mismatches, review the authentication plugin: in MySQL 8.4 the mysql_native_password plugin is disabled by default (loaded only with --mysql-native-password=ON); old accounts using this plugin and old clients cannot connect. Migrate the account with ALTER USER ... IDENTIFIED WITH caching_sha2_password BY '...'; and upgrade the client driver.

Open in DBAtlas →

More from this engine