MySQL Stored Procedure Permissions MySQL Stored Procedure Permissions mysql mysql

MySQL Stored Procedure Permissions


Your second attempt is the right approach:

GRANT EXECUTE ON PROCEDURE myDB.spName TO 'TestUser'@'localhost';

but if that is not working, verify ...

a) you (the user from which you are running all these command) have grant rights [i.e WITH GRANT OPTION]. If you are root, then you have grant rights.

b) the user exists to which you are granting execute permission e.g.

 select user from mysql.user where user  like  'test%';

If not, then create the user e.g.

CREATE USER 'TestUser'@'localhost' IDENTIFIED BY 'passwordxxxx';#depending on your needsGRANT SELECT,DELETE,UPDATE PRIVILEGES ON myDb.* TO 'TestUser'@'localhost'; 

Hope this helps :)


To answer the other part of your question regarding MySQL Workbench, I was having the same issue. But after experimenting I discovered that if you create a role and open the privileges tab at the bottom you can then drag the routine from the Model Overview into the objects box. From there just click on the newly added object and add the permissions you want for that role.

Hope that helps :)


I found this code: grant permissions on a stored procedure

USE [Database];   GRANT EXECUTE ON OBJECT::[dbo].[your stored procedure]    TO databaseUser; 

from this page: docs.microsoft.com