Techy: MySQL Error 1045 (28000): Access denied – but the login details are correct

January 1st, 2013 by Richy B. Leave a reply »

I’ve just copied over my MySQL databases to a new location on my Linux Mint 14 (Ubuntu based) machine and whenever I tried to login as a non-root user (either via the command line or via PHP), I received an error like:

ERROR 1045 (28000): Access denied for user 'currentusername'@'localhost' (using password: YES)

I tried resetting the password, deleting that user, re-creating it – all without success.

Then I noticed, in phpMyAdmin, there were three “Any” users. Deleting them allowed the other logins to work correctly.

So – if you get the “Error 1045 Access denied” message from MySQL and you are pretty sure the details are correct, check your database for the “Any” user (also check the MySQL list at http://dev.mysql.com/doc/refman/5.1/en/access-denied.html for other possibilities).

I’m not sure where there “Any” users (which showed in Red in phpMyAdmin) came from, but removing them clears the error.

Leave a Reply

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


gamy-dance