Page 1 of 1

Grant User Problem

Posted: Sat Jul 13, 2002 10:50 pm
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.

Sleep

Posted: Sun Jul 14, 2002 12:57 am
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";

Thanks,

Posted: Sun Jul 14, 2002 11:53 am
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.