ERROR 1045 (28000): Access denied for user means the username or password used to connect is invalid. The end of the error message tells you which scenario applies:
using password: YES— a password was provided but is incorrect, or the username does not exist.using password: NO— no password was included in the connection string.
Fix "using password: YES" errors
Work through the following checks in order.
Check 1: Verify the username
ApsaraDB RDS for MySQL does not provide root accounts. If you are trying to connect as root, create a dedicated account instead. See Create accounts and databases for an ApsaraDB RDS for MySQL instance.
Check 2: Escape special characters in the password
If the password contains special characters, wrap it in single quotation marks in your connection command:
mysql -h <host> -u <username> -p '<your-password>'Without the quotes, the shell interprets special characters as command operators, causing authentication to fail with the wrong password.
Check 3: Reset a forgotten password
Log on to the ApsaraDB RDS console.
Go to the instance details page and click Accounts.
Find the account and change its password.
The new password takes effect after a few minutes.
Check 4: Fix the error in DMS
If the error appears in Data Management Service (DMS):
Right-click the instance name and click Edit.
Set Access mode to Security Hosting - Manual.
Enter the correct account and password.
Fix "using password: NO" errors
ERROR 1045 (28000): Access denied for user 'XXX'@'XXX' (using password: NO)This error means no password was passed to the server. Add the -p flag to your connection command, or verify that the password field in your connection configuration is not blank.
Related topics
Application scope
RDS for MySQL instances