This is a discussion on created new user but mysql refuses him access within the MySQL Database forums, part of the Database Forums category; This is on Linux, mysql-4.1.22. As root, I created a user with grant select, insert, update, delete ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
This is on Linux, mysql-4.1.22. As root, I created a user with
grant select, insert, update, delete on WebChess to WCuser identified by 'WCpass'; and got "query ok". When I try to access mysql with WCuser, e.g. mysql -u WCuser --password=WCpass I get Error 1045 (28000) Access denied. In fact, I get this same error regardless of what I type in as the password. I did a mysqladmin reload, and then rebooted linux to restart the mysql server clean, but neither helped. I did a show grants for WCuser and it displayed the grants as requested in the original grants command, plus grant usage on *.* What do I need to do to get mysql to recognize this user? Thanks, Cameron |
|
|||
|
"Cameron Fitzhugh" <sendmespam@lottaspam.com> wrote:
> This is on Linux, mysql-4.1.22. As root, I created a user with > > grant select, insert, update, delete on WebChess > to WCuser identified by 'WCpass'; ^^^^^^ You did not specify a hostname. A MySQL account is always user@host where the host part may contain wildcards. Just user is synonym for user@'%'. > When I try to access mysql with WCuser, e.g. > > mysql -u WCuser --password=WCpass > > I get Error 1045 (28000) Access denied. In fact, I get this same error > regardless of what I type in as the password. Why didn't you copy the *complete* error message? I guess it reads: Access denied for user 'WCuser'@'localhost' (using password: YES) The problem is the 'localhost' part. A host '%' matches any host when the user connects via the network. It does not match connections from localhost (using the UNIX domain socket) if you have an anonymous account for localhost. From http://dev.mysql.com/doc/refman/5.0/...s-denied.html: "A very common error is to insert a new entry with Host='%' and User='some_user', thinking that this allows you to specify localhost to connect from the same machine. The reason that this does not work is that the default privileges include an entry with Host='localhost' and User=''. Because that entry has a Host value 'localhost' that is more specific than '%', it is used in preference to the new entry when connecting from localhost! The correct procedure is to insert a second entry with Host='localhost' and User='some_user', or to delete the entry with Host='localhost' and User=''." XL -- Axel Schwenke, Support Engineer, MySQL AB Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/ MySQL User Forums: http://forums.mysql.com/ |
|
|||
|
On Jan 31, 12:56 pm, "Cameron Fitzhugh" <sendmes...@lottaspam.com>
wrote: > This is on Linux, mysql-4.1.22. As root, I created a user with > > grant select, insert, update, delete on WebChess > to WCuser identified by 'WCpass'; > > and got "query ok". > > When I try to access mysql with WCuser, e.g. > > mysql -u WCuser --password=WCpass > > I get Error 1045 (28000) Access denied. In fact, I get this same error > regardless of what I type in as the password. > > I did a mysqladmin reload, and then rebooted linux to restart the mysql > server clean, but neither helped. I did a show grants for WCuser and it > displayed the grants as requested in the original grants command, plus grant > usage on *.* > > What do I need to do to get mysql to recognize this user? After your grant statement, did you do: FLUSH PRIVILEGES; Until then, it doesn't matter what user or password you enter... Nino |
|
|||
|
nino9stars@yahoo.com wrote:
> On Jan 31, 12:56 pm, "Cameron Fitzhugh" <sendmes...@lottaspam.com> > wrote: >> This is on Linux, mysql-4.1.22. As root, I created a user with >> >> grant select, insert, update, delete on WebChess >> to WCuser identified by 'WCpass'; >> >> and got "query ok". >> >> When I try to access mysql with WCuser, e.g. >> >> mysql -u WCuser --password=WCpass >> >> I get Error 1045 (28000) Access denied. In fact, I get this same error >> regardless of what I type in as the password. >> >> I did a mysqladmin reload, and then rebooted linux to restart the mysql >> server clean, but neither helped. I did a show grants for WCuser and it >> displayed the grants as requested in the original grants command, plus grant >> usage on *.* >> >> What do I need to do to get mysql to recognize this user? > > After your grant statement, did you do: > FLUSH PRIVILEGES; > > Until then, it doesn't matter what user or password you enter... > > Nino > You shouldn't need to issue FLUSH PRIVILEGES after doing a GRANT. You only need to do it if you issue an INSERT or UPDATE to the user's table. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |