3

I am logged in to mysql as root. I can add a user like this:

CREATE USER test01@localhost IDENTIFIED BY 'test01';

When I attempt to grant privileges to the test01 user, nothing seems to happen:

GRANT SELECT,INSERT,UPDATE,DELETE ON test_database.* TO 'test01'@'localhost';

All of the *_priv columns are set to N for the test01 user.

Any ideas what I am doing wrong here? Thanks!

Here are the results of SHOW GRANTS...

mysql> SHOW GRANTS FOR 'test01'@'localhost';
+--------------------------------------------------------------------------------------+
| Grants for test01@localhost                                                          |
+--------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'test01'@'localhost' IDENTIFIED BY PASSWORD 'removed_hash' |
+--------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Mike Moore
  • 223
  • 2
  • 7
  • 15

1 Answers1

9

All of the *_priv columns are set to N for the test01 user.

Did you check it from mysql.user table, something like this:

mysql> select * from mysql.user where user='test01' and host='localhost'\G

If so, you're checking in wrong place. All the privileges in this table is global privileges, it is assigned by using on *.*.

While you are granting at database level on test_database.*, you must check in mysql.db table:

select * from mysql.db where user='test01' and host='localhost' and db='test_database'\G

Read more: http://dev.mysql.com/doc/refman/5.0/en/grant.html

quanta
  • 51,413
  • 19
  • 159
  • 217