如何授予用户访问 mysql 上所有存储过程的权限?
问题描述:
我正在尝试以下操作:
DROP USER IF EXISTS 'my_user'@'%';
CREATE USER 'my_user'@'%' IDENTIFIED BY 'my_pwd';
GRANT EXECUTE ON PROCEDURE mydb.* TO 'my_user'@'%';
但我收到错误:
Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used 0.000 sec
如果我明确命名一个过程:
If I name a proc explicitly:
DROP USER IF EXISTS 'my_user'@'%';
CREATE USER 'my_user'@'%' IDENTIFIED BY 'my_pwd';
GRANT EXECUTE ON PROCEDURE mydb.my_proc TO 'my_user'@'%';
然后它工作正常,但我想允许用户帐户访问数据库上的每个 proc,是否可以在不明确授予每个单独 proc 权限的情况下执行此操作?
then it works fine, but I want to allow the user account to have access to every proc on the db, is there anyway to do this without explicitly granting permission to every individual proc?
答
改用这个,它会起作用:
Use this instead, it will work:
GRANT EXECUTE ON mydb.* TO 'my_user'@'%';