• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

MySQL create user problem, wildcard host users can't login locally

Sureshot324

Diamond Member
This problem only seems to happen in Linux, not Windows. If I create a user in mysql with a wildcard host (or don't specify the host at all, which should do the same thing), they are unable to login locally. I just get an error:
ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using password: YES)
I use this command to create the user:
CREATE USER myuser IDENTIFIED BY 'password'
and this command to login to mysql:
mysql -u myuser -p

If I specify localhost like this:
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'password'

then they are able to login locally fine. Is this normal? If I specify a wildcard host, shouldn't they be able to login from anywhere, including localhost?
 
Have you GRANTED privs for this user? If not, I don't think a host will be used, or no access to resources will be given. I don't know about Windows, but for everything in Linux usually will have to do it with a GRANT afterwards, or its done for me via PHPMyAdmin

soo..

Code:
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'
WITH GRANT OPTION;

That's the wildcard host. Please keep in mind this will give that user privs for EVERYTHING on the database.

http://dev.mysql.com/doc/refman/5.1/en/adding-users.html
 
Last edited:
I tried that but no luck. I don't think the problem is with privileges, because if the user exists I should be able to at least login to mysql, even with no privileges at all. Like I said, if I create myuser@localhost, everything works fine, but if I create myuser@% (and drop myuser@localhost), I can't even login to mysql locally, and when I try it says access denied for myuser@localhost.

It seems like the wildcard isn't working, or at least localhost isn't accepted for the wildcard. I could just create both myuser@locahost and myuser@% but I don't think I should have to and on Windows I don't.
 
Back
Top