Comments - ERROR 1141 (42000): There is no such grant defined for user

4 years, 10 months ago William Hearn

We have a role defined with one privilege. When we execute show grants for <role name>, we get the error described.

 
4 years, 10 months ago Ian Gilfillan

Please provide the statements, otherwise there's no information to go on.

 
4 years, 10 months ago William Hearn

mysql> show grants for myreader;

 
4 years, 10 months ago Ian Gilfillan

Note that there is a difference between, for example:

SHOW GRANTS FOR 'root';
ERROR 1141 (42000): There is no such grant defined for user 'root' on host '%'

and

SHOW GRANTS FOR 'root'@'localhost';

which returns grants.

 
4 years, 9 months ago William Hearn

Found the issue. There was a management perl script that was expecting a user-host combination, and the user was actually a role. We added a decision block to account for roles in the user table. Thanks for your assistance.

 
4 years, 10 months ago Anel Husakovic

Hi, How did you created `myreader` and which mariadb version you are using, also what is the output of `select * from mysql.user`? Please provide as much information as needed to help us solve your problem.

 
4 years, 10 months ago William Hearn

The select from mysql.user works fine. It is the SHOW GRANTS that is having the issue. The version is 10.1.12. The role was created long ago. I am the new dba and noticed the backup scripts reporting errors when running mysql --batch --execute='show grants for $user;' So I tried the command on the command line and got the failure. Then I tried the command directly within the database and got the error.

 
4 years, 10 months ago Anel Husakovic

And did you analyse what are privileges of your role/user?

Please paste here in comment output from

select * from mysql.user where user=your_user_of_interest 
 
4 years, 10 months ago Anel Husakovic

Also what are the privileges of your current user ? SHOW GRANTS FOR CURRENT_USER();

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.