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.
Best Answer
Yes... this works as expected if you don't grant the user the
SELECT
privilege on themysql.proc
table, either directly or indirectly, such as withGRANT 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, likeEXECUTE
.Under the hood, the lack of
SELECT
onmysql.proc
also prevents the user from seeing the procedures they don't have access to via theinformation_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.