How to grant execute on specific stored procedure to user

20,943

Yes... this works as expected if you don't grant the user the SELECT privilege on the mysql.proc table, either directly or indirectly, such as with GRANT SELECT ON *.* TO ...

Without SELECT permission on this table, a user can only see the existence of stored procedures and stored functions where they have other permissions, like EXECUTE.

Under the hood, the lack of SELECT on mysql.proc also prevents the user from seeing the procedures they don't have access to via the information_schema.routines pseudo-table.

You shouldn't need to GRANT SELECT ON mysql.proc to enable the user to execute procedures or functions... and if you do, then that seems like the question.

Share:
20,943
TriGerZ
Author by

TriGerZ

Updated on July 18, 2022

Comments

  • TriGerZ
    TriGerZ almost 2 years

    I have created some stored procedure on a specific schema.

    In this stored procedure, I want to grant execute privilege.

    So I wrote that :

    GRANT EXECUTE ON PROCEDURE schema_name.proc_name TO 'user_name';
    GRANT SELECT ON mysql.proc to 'user_name';
    

    The problem is : My user can see every stored procedure. I wish he could only see the procedure where he has the EXECUTE privilege.

    Is there a way to achieve that ?

    Thanks in advance.