Bluehost.com Web Hosting $6.95

created new user but mysql refuses him access

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-31-2007
Cameron Fitzhugh
 
Posts: n/a
Default created new user but mysql refuses him access

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


Reply With Quote
  #2 (permalink)  
Old 01-31-2007
Axel Schwenke
 
Posts: n/a
Default Re: created new user but mysql refuses him access

"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/
Reply With Quote
  #3 (permalink)  
Old 02-03-2007
nino9stars@yahoo.com
 
Posts: n/a
Default Re: created new user but mysql refuses him access

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

Reply With Quote
  #4 (permalink)  
Old 02-03-2007
Jerry Stuckle
 
Posts: n/a
Default Re: created new user but mysql refuses him access

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
==================
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:50 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0