Hi Virindera

The following is from the maunal for MySQL 3.23.11-alpha, so I am going to
assume that it applies for 3.23.38
 also.

<quote>

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='';

</quote>

This means that even if you add  a user as user@'%', you need to add the
same user as user@localhost for that user to be able to access the server
from the host it is running from.

So, you should run both of the following queries, to add user which can
access the database from *any* host - remote or local:

GRANT ALL ON db_name.* TO user@'%' IDENTIFIED BY 'some_password' ;
GRANT ALL ON db_name.* TO user@localhost IDENTIFIED BY 'some_password' ;

Hope that helps!

Regards,
-Varun

----- Original Message -----
From: "Vertical rains" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 17, 2002 10:58 AM
Subject: [ilugd]: Trivial MySQL problem


> Hi everyone
> 1) I have a mySQL problem.After logging in as root and creating a database
I am trying   to grant all the privileges on it to a user with the following
command which
>   I read in the book "MySQL by Paul Dubois".
>   GRANT ALL ON db_name.* TO user@% IDENTIFIED BY 'some_password' ;
>   On running the above command i get the following syntax error
>
> ERROR 1064: You have an error in your SQL syntax near '% identified by
'mypassword'' at line 1
>
> 2) Next i modiyfied the command to
> GRANT ALL ON db_name.* TO user@'%' IDENTIFIED BY 'some_password' ;
> This particular query ran FINE but when i try connecting to the databse
with the following
> mysql -p db_name
> and after specifying the correct password.I get
>  ERROR 1045: Access denied for user: 'user@localhost' (Using password:
YES)
>
>  I did like to know what am i doing wrong.Why am i not able to run the
query  in  point (1) and secondly why am i not able to get connected in  (2)
>  What am i doing wrong over here.Please help.
>  I am using linux 7.1 kernel 2.4.2-2 and MySQL 3.23.38
>  Thanks everybody.
>  Regards
>  Virindera
> --
>
> _______________________________________________
> Win a ski trip!
> http://www.nowcode.com/register.asp?affiliate=1net2phone3a
>
>
>           ================================================
> To subscribe, send email to [EMAIL PROTECTED] with subscribe in
subject header
> To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in
subject header
> Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
>           =================================================
>


          ================================================
To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header
Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
          =================================================

Reply via email to