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 [email protected] 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.

1
  • 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. Commented Mar 7, 2013 at 17:54

1 Answer 1

5

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

grant all privileges on *.* to [email protected] identified by 'password';

Then the user would appear there.

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

Sign up to request clarification or add additional context in comments.

2 Comments

Oh thanks! I didn't know this. So, what exactly is the difference between between the two tables mysql.user and mysql.db?
As I said, mysql.user is privileges on any database and mysql.db is privileges by database.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.