Grant all to username - for inserting data

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
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Grant all to username - for inserting data

Post 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
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post 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.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post 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.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

RESOLVED

Post by anjanesh »

Yes thanks that worked. But before that I also tried accessing it with username root and no password. That worked too.
Thanks
Post Reply