Omidreza Bagheri
Omidreza Bagheri

Reputation: 841

How can I grant to the limited users to see the structure of mysql routines?

How can I grant somebody to see the structure of mysql routines? The following command can be used to show the structure of routines:

show create function FUNCTION_NAME

or

show create procedure PROCEDURE_NAME

but It should be run by the user with grant all permission. I don't want to give grant all to the user. What is the exact grant I need or what is the alternative solutions?

Upvotes: 1

Views: 642

Answers (2)

Kelly Bang
Kelly Bang

Reputation: 756

For MySQL 8.20+ you can use:

GRANT SHOW_ROUTINE ON . TO username

MySQL 8 Reference

Upvotes: 0

Nanne
Nanne

Reputation: 64429

from the manual

To use either statement, you must be the user named in the routine DEFINER clause or have SELECT access to the mysql.proc table.

So granting SELECT to the mysql.proc table should be sufficient.

Upvotes: 1

Related Questions