MySQL Error 1045: Access Denied for User with Correct Password
When attempting to connect to a MySQL instance as a newly created user 'bill', the error "ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)" is encountered. Despite providing the correct password, access is denied.
Understanding the Issue
As per the documentation, MySQL prioritizes user accounts with the most specific Host values first. In this case, there is likely an anonymous user account ''@'localhost' or ''@'127.0.0.1', which would match 'bill'@'%' and take precedence, effectively blocking the intended connection.
Recommended Solution
To resolve the issue, it is recommended to drop the anonymous user. This user often exists in default installations and should be removed for security reasons.
Related Observations
Additional insights from the provided setup:
The above is the detailed content of Why Does MySQL Return 'Access Denied' Even with the Correct Password?. For more information, please follow other related articles on the PHP Chinese website!