让我们首先从表MySQL.user中显示所有用户和主机-
mysql> select user,host from Mysql.user;
这将产生以下输出-
+------------------+-----------+ | user | host | +------------------+-----------+ | Bob | % | | Charlie | % | | Robert | % | | User2 | % | | mysql.infoschema | % | | mysql.session | % | | mysql.sys | % | | root | % | | @UserName@ | localhost | | Adam Smith | localhost | | Chris | localhost | | David | localhost | | James | localhost | | John | localhost | | John Doe | localhost | | User1 | localhost | | am | localhost | | hbstudent | localhost | | mysql.infoschema | localhost | | mysql.session | localhost | +------------------+-----------+ 20 rows in set (0.00 sec)
现在让我们授予用户“ Robert”访问MySQL中的所有存储过程的权限:
mysql> GRANT EXECUTE ON web.* TO 'Robert'@'%';
这将产生以下输出-