Ashka
Ashka

Reputation: 53

Grant privileges to user for one database issue

I am new to MySQL. I have Created one user for "root" login, I want to give all privileges for only one database to this user. I tried it :

GRANT ALL ON db.* to userx IDENTIFIED BY 'xyz';

but it gives error:

Error Code: 1044. Access denied for user 'root'@'%' to database 'db'

I checked rights for root user by select * from mysql.user;, root user has all rights.

Can anyone pls help with this issue?

Upvotes: 1

Views: 197

Answers (2)

Robin
Robin

Reputation: 104

Try userx with the format 'user'@'location'. If you are on a local database, for example.

GRANT ALL ON db.* TO 'user'@'localhost' IDENTIFIED BY 'xyz';

Take care with that '@' in the middle.

Upvotes: 1

Rakhi
Rakhi

Reputation: 369

login with your root and password and then click on the database you want to give priviledges now go to priviledges tag and click on add user provide the username password and hosttype for and then go to "database for user section" and check the option

  Grant all privileges on database "yourdatabasename" 

and then click on go button. See usage is mentioned on the database after that logout from root and login with the given username and password.

Upvotes: 0

Related Questions