All Collections
Error Messages and Tech Tips
ERROR: 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
ERROR: 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

MySQL 8, caching_sha2_password, connection error

Islam Essam avatar
Written by Islam Essam
Updated over a week ago

If you keep getting the following error from MySQL when trying to connect. Here are a few things to check:

  • Check that you use the hostname localhost and not 127.0.0.1 (in both cases, the error message will return localhost so this could be tricky)

  • Check that your MySQL user is not using the auth_socket authentication method. If this is the case, it means that your MySQL does not in fact use a password to authenticate

To check the authentication method of each user, run the following in MySQL:

SELECT user,authentication_string,plugin,host FROM mysql.user;
Did this answer your question?