1

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?

Rohit Gaikwad
  • 817
  • 2
  • 8
  • 24
Omidreza Bagheri
  • 781
  • 1
  • 11
  • 22

2 Answers2

1

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.

Nanne
  • 64,065
  • 16
  • 119
  • 163
  • Thanks so much @Nanne , your answer solves my problem. I had test the grant to `information_schema.ROUTINES` but It didn't work correctly. The limited user can not access to `ROUTINE_DEFINITION`. But the grant to `mysql.proc` solves my problem. Thanks again :D – Omidreza Bagheri Sep 15 '15 at 09:02
0

For MySQL 8.20+ you can use:

GRANT SHOW_ROUTINE ON . TO username

MySQL 8 Reference

Kelly Bang
  • 727
  • 6
  • 16