List:General Discussion« Previous MessageNext Message »
From:Ben Clewett Date:April 18 2008 2:40pm
Subject:Re: Can't get a login shell for some databases
View as plain text  

Pam Astor wrote:
>> A user in MySql is not just a username, but a username and a host.
>>
>> The host of '%' denotes all hosts accept 'localhost'.
>>
>> Therefore you usually require two entries for each user:
>>
>> CREATE USER ben@'%' INDENTIFIED BY 'ben';
>> CREATE USER ben@'localhost' INDENTIFIED BY 'ben';
>>
>> Does this help?
> 
> 
> 
> Makes sense, BUT, isn't the info between the last set of tickmarks '' the password
> for
> 
> the user?

Yes.

> 
> When I created the users, I ran the command:
> 
> grant usage on db1.* to joe identified by 'whateverpassword';
> 
> Then I ran a second grant command:
> 
> grant select, drop, etc, on db1.* to joe;


The ANSI-SQL syntax is to just use GRANT to create users.  You will 
still need to use GRANT twice for both users: joe@'%' and joe@'localhost'.

But I find the MySql syntax for creating user with CREATE USER and then 
GRANT easier to follow:

CREATE USER joe@'%' IDENTIFIED BY 'whateverpassword';
CREATE USER joe@'localhost' IDENTIFIED BY 'whateverpassword';

GRANT ALL ON db1.* TO joe@'%';
GRANT ALL ON db1.* TO joe@'localhost';

If you see what I mean...

Just remember that a user always has a host, and you should always use 
the two together.

Ben




> 
> 
> 
> I should probally say that my 5.0.22 MySQL database is on a centos 5.1 box.
> _________________________________________________________________
> Pack up or back up–use SkyDrive to transfer files or keep extra copies. Learn
> how.
>
> http://www.windowslive.com/skydrive/overview.html?ocid=TXT_TAGLM_WL_Refresh_skydrive_packup_042008
Thread
Can't get a login shell for some databasesPam Astor17 Apr
  • Re: Can't get a login shell for some databasesSebastian Mendel18 Apr
    • RE: Can't get a login shell for some databasesPam Astor18 Apr
      • Re: Can't get a login shell for some databasesSebastian Mendel18 Apr
        • RE: Can't get a login shell for some databasesPam Astor18 Apr
      • Re: Can't get a login shell for some databasesBen Clewett18 Apr
        • RE: Can't get a login shell for some databasesPam Astor18 Apr
          • Re: Can't get a login shell for some databasesBen Clewett18 Apr
            • RE: Can't get a login shell for some databasesPam Astor18 Apr
              • Re: Can't get a login shell for some databasesBen Clewett21 Apr
                • RE: Can't get a login shell for some databases SOLVEDPam Astor21 Apr
RE: Can't get a login shell for some databasesPam Astor18 Apr