Dear Virindera >From the manual
<quote> In order to accommodate granting rights to users from arbitrary hosts, MySQL supports specifying the user_name value in the form user@host. If you want to specify a user string containing special characters (such as `-'), or a host string containing special characters or wildcard characters (such as `%'), you can quote the user or host name (e.g., 'test-user'@'test-hostname'). You can specify wildcards in the hostname. For example, user@"%.loc.gov" applies to user for any host in the loc.gov domain, and user@"144.155.166.%" applies to user for any host in the 144.155.166 class C subnet. </quote> What this implies is that: 1) % is a special character - the wildcard character 2) You need to quote any special characters Therefore, you need to quote the % whenever you use, be it as part of an expression, of the complete expression itself. On the other hand, you should be able to get away with something like - user@hostname - no quotes need around hostname. Regards, -Varun ----- Original Message ----- From: "Vertical rains" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 19, 2002 7:47 PM Subject: Re: [ilugd]: Trivial MySQL problem -Thanx > hi varun > Thanx a lot .Your solution did work :) and to > check up i went thru the manual again and it > still is applicable to 3.23.38 > Although what i cannot understand is how come > the query does'nt run if one does'nt quote > the percentage.??!! > At least that's what is wriiten in the book ( > although not in the manual) > Thanx a lot again > Virindera > -----Original Message----- > From: "Varun Varma" <[EMAIL PROTECTED]> > Date: Tue, 19 Feb 2002 04:47:33 +0530 > To: <[EMAIL PROTECTED]> > Subject: Re: [ilugd]: Trivial MySQL problem > > > > 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 > > > > ================================================= > > > > > > > > > > > -- > > _______________________________________________ > 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 =================================================