2

I've given all the privileges to a new user to access a MySQL database using the following query

 grant all privileges on database.* to root@example.com identified by 'password';

followed by

 flush privileges;

After this i see a new row is added to mysql.user but with 'N' in all the columns (like Select_priv = N, Insert_priv=N and so on).

Does N means that the user is not granted with all the privileges? Is this the way to grant permissions for a user? This is the first time i'm doing this. Need some help

Thanks.

Anil
  • 2,405
  • 6
  • 25
  • 28
  • Wrong table - you only granted on a specific database, try the `db` table. You also do not need to flush as you did not edit the tables directly. – Boris the Spider Mar 07 '13 at 17:54

1 Answers1

5

You are looking in the wrong table, mysql.user defines global privileges, so if you did something like:

grant all privileges on *.* to root@example.com identified by 'password';

Then the user would appear there.

The table you want to look at is mysql.db which defines database specific privileges.

Boris the Spider
  • 59,842
  • 6
  • 106
  • 166
  • Oh thanks! I didn't know this. So, what exactly is the difference between between the two tables mysql.user and mysql.db? – Anil Mar 07 '13 at 18:02
  • As I said, `mysql.user` is privileges on _any database_ and `mysql.db` is privileges _by database_. – Boris the Spider Mar 07 '13 at 18:11