dev.e.loper
dev.e.loper

Reputation: 36044

SHOW GRANTS displays there is no such grant defined for user

I have a user that is currently running my MySQL database. I wanted to see the rights that user has by executing the following:

SHOW GRANTS FOR 'myuser'@'localhost';

and I got

ERROR 1141 (42000): There is no such grant defined for user 'myuser' on host 'localhost'

Shouldn't I see some permissions for that user since it's currently being used to read/write>

Edit: When I run the following query to see the hostname associated with the user, it returns % as the host.

select host from mysql.user where user = 'myuser';

Upvotes: 3

Views: 21244

Answers (2)

Andreas Wederbrand
Andreas Wederbrand

Reputation: 39991

To see the rights of the currently logged in use it should be suffient with just SHOW GRANTS

To find the hosts and wild cards used for a user run select Host from mysql.user where User = 'myuser';, Then use that host (and user) to run SHOW GRANTS FOR myuser@<host>

Upvotes: 2

Barmar
Barmar

Reputation: 781210

The hostname % is a wildcard meaning any host. So to see his grants, do:

SHOW GRANTS FOR 'myuser'@'%';

Upvotes: 6

Related Questions