Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to grant a user access to all stored procedures on mysql?

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?

like image 591
Daniel Robinson Avatar asked Feb 09 '16 21:02

Daniel Robinson


People also ask

How do I grant all permissions in MySQL?

To GRANT ALL privileges to a user , allowing that user full control over a specific database , use the following syntax: mysql> GRANT ALL PRIVILEGES ON database_name. * TO 'username'@'localhost';

How do I grant permission for a stored procedure?

To grant permissions on a stored procedureExpand Stored Procedures, right-click the procedure to grant permissions on, and then select Properties. From Stored Procedure Properties, select the Permissions page. To grant permissions to a user, database role, or application role, select Search.

How do I grant a stored procedure to run permissions in MySQL?

The syntax for granting EXECUTE privileges on a function/procedure in MySQL is: GRANT EXECUTE ON [ PROCEDURE | FUNCTION ] object TO user; EXECUTE. The ability to execute the function or procedure.


1 Answers

Use this instead, it will work:

GRANT EXECUTE ON mydb.* TO 'my_user'@'%';
like image 141
Phiter Avatar answered Sep 21 '22 22:09

Phiter