How to grant a user access to all stored procedures on mysql?
22,314
Use this instead, it will work:
GRANT EXECUTE ON mydb.* TO 'my_user'@'%';
Comments
-
Daniel Robinson over 4 years
I'm trying the following:
DROP USER IF EXISTS 'my_user'@'%'; CREATE USER 'my_user'@'%' IDENTIFIED BY 'my_pwd'; GRANT EXECUTE ON PROCEDURE mydb.* TO 'my_user'@'%';
but I get the error:
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'@'%';
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?
-
user2338823 almost 4 yearsIs the difference between the query and the answer due to the fact that mydb.* is NOT a procedure but (possibly) many procedures ? Where is this mentioned in the manual?
-
Phiter almost 4 years@user2338823 exactly. If you try
GRANT EXECUTE ON PROCEDURE
it expects a single procedure. My command grants execute permission for every procedure in the database. -
user2338823 almost 4 yearsIs this mentioned in the manual ? May I ask, how did you learn this ?