From: Ben Clewett Date: April 18 2008 2:40pm Subject: Re: Can't get a login shell for some databases List-Archive: http://lists.mysql.com/mysql/212379 Message-Id: <4808B2EB.9060309@clewett.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit 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