FreeKB - mySQL / MariaDB Resolve "1045 (28000): Access denied for user username@localhost (using password: YES)"
mySQL / MariaDB - Resolve "1045 (28000): Access denied for user username@localhost (using password: YES)"

Let's say your mySQL or MariaDB error log contains the following warning.

Access denied for user 'john.doe'@'server1.example.com' (using password: YES)

 

Notice in this example that access is denied for user john.doe. If you have root access to mySQL or MariaDB, ensure John Doe's user account exists. Notice in this example that john.doe has access to host %. The % character means that john.doe is allowed to make remote connections to mySQL or MariaDB.

~]# mysql -e "select User from mysql.user where User = 'john.doe'\G"
*************************** 1. row ***************************
User: john.doe
Password: *964A30F03EBE2D0D8EADC172640E4389BC9AF7FF
Host: %

 

Notice that the hashed password in this example is 964A30F03EBE2D0D8EADC172640E4389BC9AF7FF. If you know what the user's password is supposed to be, the select password command can be used to verify the users password matches the hashed password.

~]# mysql -e "select password('itsasecret')"
+-------------------------------------------+
| password('itsasecret')                    |
+-------------------------------------------+
| *964A30F03EBE2D0D8EADC172640E4389BC9AF7FF |
+-------------------------------------------+

 

If the password is incorrect, you can updated the password.

mysql -e "update mysql.user SET Password=PASSWORD('itsasecret') where User='john.doe'"
mysql -e "update mysql.user SET authentication_string=PASSWORD('itsasecret') where User='john.doe'"

 

And then flush privileges.

mysql -e "FLUSH PRIVILEGES"

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 31789 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |