出於對infomation_schema虛擬數據庫對象權限的不熟悉
在應用提出需要訪問innodb_locks數據權限時,想着通過以下方式賦權
mysql> grant select on information_schema.* to 'test'@'%'; ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema'
原因是information_schema數據庫的權限是默認對所有用戶開放的
再具體訪問數據庫里面的表數據時,又有如下報錯:
mysql> select * from innodb_locks; ERROR 1227 (42000): Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
該問題可以通過process權限解決
GRANT PROCESS ON *.* TO 'test'@'%'
搞定