Thursday, April 04, 2013

MySQL ERROR 1045 (28000): Access denied for user

This issue happens every once in a while in certain mysql installations. You know the password and the user, you have created it yourself and yet mysql complains:
$ mysql -u myUser -p myDB
Enter password: 
ERROR 1045 (28000): Access denied for user 'myUser'@'localhost' (using password: YES)
Almost 100% of the time this error comes up as a result of a blank user defined for localhost so the below commands should solve it:
mysql> delete from mysql.user where Host='localhost' and user='';
mysql> flush privileges;

No comments:

Followers