5:那么我们来创建一个测试账号test,授子程序层级的权限.如下所示:
?
- mysql>?DROP?PROCEDURE?IF?EXISTS?PRC_TEST;?
- Query?OK,?0?rows?affected?(0.00?sec)?
- ??
- mysql>?DELIMITER?//?
- mysql>?CREATE?PROCEDURE?PRC_TEST()?
- ????->?BEGIN?
- ????->????SELECT?*?FROM?kkk;?
- ????->?END?//?
- Query?OK,?0?rows?affected?(0.00?sec)?
- ??
- mysql>?DELIMITER?;?
- ??
- mysql>?grant?execute?on?procedure?MyDB.PRC_TEST?to?test@'%'?identified?by?'test';?
- Query?OK,?0?rows?affected?(0.00?sec)?
- ??
- mysql>??
- ??
- ??
- mysql>?show?grants?for?test;?
- +-----------------------------------------------------------------------------------------------------+?
- |?Grants?for?test@%???????????????????????????????????????????????????????????????????????????????????|?
- +-----------------------------------------------------------------------------------------------------+?
- |?GRANT?USAGE?ON?*.*?TO?'test'@'%'?IDENTIFIED?BY?PASSWORD?'*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29'?|?
- |?GRANT?EXECUTE?ON?PROCEDURE?`MyDB`.`prc_test`?TO?'test'@'%'??????????????????????????????????????????|?
- +-----------------------------------------------------------------------------------------------------+?
- 2?rows?in?set?(0.00?sec)?
- ??
- mysql>?select?*?from?mysql.procs_priv?where?User='test';?
- +------+------+------+--------------+--------------+----------------+-----------+---------------------+?
- |?Host?|?Db???|?User?|?Routine_name?|?Routine_type?|?Grantor????????|?Proc_priv?|?Timestamp???????????|?
- +------+------+------+--------------+--------------+----------------+-----------+---------------------+?
- |?%????|?MyDB?|?test?|?PRC_TEST?????|?PROCEDURE????|?root@localhost?|?Execute???|?0000-00-00?00:00:00?|?
- +------+------+------+--------------+--------------+----------------+-----------+---------------------+?
- 1?row?in?set?(0.00?sec)?
- ??
- mysql>??
所以,如果需要查看用户被授予的权限,就需要从这五个层级来查看被授予的权限.从上到下或从小到上,逐一检查各个层级被授予的权限.
(编辑:ASP站长网)
|