List:General Discussion« Previous MessageNext Message »
From:Baron Schwartz Date:May 20 2007 4:10pm
Subject:Re: Problem with GRANT ... 'user'@'%'
View as plain text  
Mathieu Bruneau wrote:
> Baron Schwartz a écrit :
>> Hi,
>>
>> Miguel Cardenas wrote:
>>> Hello list
>>>
>>> I have a problem adding a user with host '%' ...
>>>
>>> *** If I add a user with host '%' when trying to connect get this error:
>>> ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using
>>> password: YES)
>>>
>>> *** If I add the same user with localhost it connects and works fine...
>>>
>>> My specific doubt is:
>>>
>>> 1) do I need to add a same user with both '%' and 'localhost' to
>>> connect locally and from another location???, or...
>>>
>>> 2) for some reason a host '%' is not working or need to do something
>>> so it allows connections from any host?
>> Remember to quote the user and host carefully.  So,
>>
>> GRANT ... TO 'user'@'%'
>>
>> not
>>
>> GRANT ... TO user@%
>>
>> If you have doubts about what you actually granted, do this:
>>
>> SHOW GRANTS FOR 'user'
>>
>> And see what host it claims the permissions are for.  If you did it
>> wrong, it will say no such user exists.  If you do all this and
>> everything looks okay, write back to the list again and maybe we can
>> help you more.
>>
>> Oh, one more place to look is at the server configuration in /etc/my.cnf
>> or equivalent, to be sure networking is configured right.  You want to
>> check the bind-address and skip-networking settings.  You don't want
>> skip-networking, and you want bind-address set to the machine's IP
>> address.  Now that I think of it, this is more likely to be the problem
>> for you.
>>
>> Cheers
>> Baron
>>
> 
> 
> Localhost is indeed a special value that isn't include in '%'. It's a
> feature not a bug ;)

Hm, I didn't know that!  I thought it was only a special value to the client 
tools, which I know will try to connect via socket on UNIX machines when they 
see 'localhost' but will try to connect via TCP/IP when they see '127.0.0.1'. 
Thanks for pointing this out!

Baron
Thread
Problem with GRANT ... 'user'@'%'Miguel Cardenas20 May
  • Re: Problem with GRANT ... 'user'@'%'Baron Schwartz20 May
    • Re: Problem with GRANT ... 'user'@'%'Mathieu Bruneau20 May
      • Re: Problem with GRANT ... 'user'@'%'Baron Schwartz20 May
        • Re: Problem with GRANT ... 'user'@'%'Miguel Cardenas22 May
        • Selecting rows by DATE rangesMiguel Cardenas24 Jun
          • Re: Selecting rows by DATE rangesPintér Tibor24 Jun
          • Re: Selecting rows by DATE rangesMogens Melander25 Jun
            • Re: Selecting rows by DATE rangesJørn Dahl-Stamnes25 Jun
      • Re: Problem with GRANT ... 'user'@'%'Miguel Cardenas22 May
        • Re: Problem with GRANT ... 'user'@'%'Mogens Melander22 May
    • Re: Problem with GRANT ... 'user'@'%'Miguel Cardenas21 May
      • Re: Problem with GRANT ... 'user'@'%'Mogens Melander21 May
      • Re: Problem with GRANT ... 'user'@'%'Baron Schwartz21 May
        • Re: Problem with GRANT ... 'user'@'%'Miguel Cardenas22 May