Page 1 of 1

Grant all to username - for inserting data

Posted: Fri Jan 02, 2004 12:50 pm
by anjanesh
I am using MySQL on a single machine having Windows acting as localhost.
I added a new user administrator with password somepass
I logged on to MySQL with root and set the GRANT ALL ON *.* TO administrator identified by 'somepass';
But the grant_priv field in the user table is still 'N' so I updated it to 'Y'.

This is what I have :

Code: Select all

$dblink=mysql_connect("localhost","administrator","somepass") or die("Could not connect");
I don't understand what went wrong since I get this error :
Warning: Access denied for user: 'administrator@localhost' (Using password: YES) in Register.php on line 11


If I simply do mysql_select_db("rac"); it works but I can only select query and not insert.

Thanks

Posted: Fri Jan 02, 2004 12:52 pm
by microthick
MySQL Control Center ( http://www.mysql.com/products/mysqlcc/index.html ) makes it easy to change access levels for different users.

You could try that if you want.

Posted: Fri Jan 02, 2004 1:24 pm
by anjanesh
I really don't want this done by a third party s/w - I need to get this done manually because I got to run this & show it to somone.

Posted: Fri Jan 02, 2004 4:09 pm
by JAM
If you are using this at home, you are seen as user@localhost. If you use this at your host (if any) you'll been seen as user@[domain|ip].

To solve this (likely your issue);

Code: Select all

GRANT ALL PRIVILEGES ON *.* TO administrator@localhost IDENTIFIED BY 'somepass';
GRANT ALL PRIVILEGES ON *.* TO administrator@127.0.0.1 IDENTIFIED BY 'somepass';
...twice. Spot the difference.

RESOLVED

Posted: Fri Jan 02, 2004 11:53 pm
by anjanesh
Yes thanks that worked. But before that I also tried accessing it with username root and no password. That worked too.
Thanks