Using this command
GRANT ALL PRIVILEGES ON *.* to 'brian'@'%' identified by 'password';
I try to login with:
mysql -u brian -ppassword
The error is:
ERROR 1045 (28000): Access denied for user 'brian'@'localhost' (using password: YES)
I am doing this as root and I did try to flush privileges.
I tried this with countless users but it does not seem to work. I can create a user with no password and login works. Command line and from phpmyadmin
Also check to see if the user was in mysql.user which it is.
Show grants for brian shows:
| GRANT ALL PRIVILEGES ON *.* TO 'brian'@'%' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' |
I just created an account to provide one other possibility for future searchers:
It might be kind of obvious to experienced users, but my password was randomly generated and contained a "\". Took me a while until I found out that that character seems to cause problems, resulting in me not being able to log in.
You probably have this perpetual MySQL problem where one of the default users in the user table is
'' @ localhost
, which winds up denying alllocalhost
users later in the table. What I would do ismysqldump
themysql
database and look for this entry in theUser
table; if found, delete it and flush privileges.For more details see https://dev.mysql.com/doc/refman/5.5/en/connection-access.html.
You forgot the quotes around brian in your grant statement. Try it like this:
GRANT ALL PRIVILEGES ON *.* to 'brian'@'%' identified by 'password';
I think 'Russell Silva' is right...
I created an user by
But I cannot login in this account.The console told me that
So I created an user with the same username except that changing '%' to 'localhost',and I could finally login in as 'username'. It's quite weird for me though.
In my case it was due to me clicking "SSL: REQUIRE SSL" (in phpmyadmin). When I changed it to "REQUIRE NONE" I could log in.
This is a problem caused by the anonymous users. Once I install MySQL I always run
and select to set/change the root password, remove anonymous users, disallow remote root login, remove the test database. This will remove the anonymous user and secure your installation. It should also solve the problem you have.