Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11661

Why grant select on view does not grant permission in all necessary objects to select it?

$
0
0

In MySQL 5.7 I've tried

grant select on sys.innodb_lock_waits to 'zbx_monitor'@'%';

But I got the error the selecting it with zbx_monitor user.

ERROR 1356 (HY000): View 'sys.innodb_lock_waits' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

So I solve it granting permission in a function used in this view and now it worked.

grant execute on function sys.format_statement to 'zbx_monitor'@'%';

But in MySQL 8.0 I need to grant execute in quote_identifier function as well, but still does not work, I got the following error:

ERROR 1143 (42000): SELECT command denied to user 'zbx_monitor'@'%' for column 'ENGINE_LOCK_ID' in table 'data_locks'

Why does a simple grant select in the view does not work? Is this right? I need to grant in individual objects as well inside the view? I mean, a view should abstract everything, including permissions?

Edit: I solve the error in MySQL 8.0 with:

GRANT SELECT ON performance_schema.data_lock_waits TO 'zbx_monitor'@'%';GRANT SELECT ON performance_schema.data_locks TO 'zbx_monitor'@'%';

But I still doesn't undestand why a single grant select on the view sys.innodb_lock_waits does not work.


Viewing all articles
Browse latest Browse all 11661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>