Grant User Problem

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
EricS
Forum Contributor
Posts: 183
Joined: Thu Jul 11, 2002 12:02 am
Location: Atlanta, Ga

Grant User Problem

Post by EricS »

I created a user with something similar to the following:

Code: Select all

GRANT UPDATE, INSERT, DELETE ON table_name.* TO user_name IDENTIFIED BY "user_password";
I intentionally left out the host so that it would default to all hosts so that I can connect from any location (I travel alot).

It accepted the command and I flushed the privileges to update mysql.

I can connect from any host but localhost, which I really need.

What did I do wrong and how can I fix it?

Thanks for everything.
User avatar
sam
Forum Contributor
Posts: 217
Joined: Thu Apr 18, 2002 11:11 pm
Location: Northern California
Contact:

Sleep

Post by sam »

From the mysql manual:
The simple form user is a synonym for user@"%". NOTE: If you allow anonymous users to connect to the MySQL server (which is the default), you should also add all local users as user@localhost because otherwise the anonymous user entry for the local host in the mysql.user table will be used when the user tries to log into the MySQL server from the local machine! Anonymous users are defined by inserting entries with User='' into the mysql.user table. You can verify if this applies to you by executing this query:
mysql> SELECT Host,User FROM mysql.user WHERE User='';
I'm to tired to decypher the meaning but I think it is saying to add another user with the localhost seting:

Code: Select all

GRANT UPDATE, INSERT, DELETE ON table_name.* TO user_name@localhost IDENTIFIED BY "user_password";
EricS
Forum Contributor
Posts: 183
Joined: Thu Jul 11, 2002 12:02 am
Location: Atlanta, Ga

Thanks,

Post by EricS »

Sam I appreciate it.

I was so burnt out last night when I hit this problem that I was looking in the PHP reference manual and not the MySQL manual. What a dope.

Thanks again.
Post Reply