Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqldump: insufficient privileges to show create function 'function name'

Tags:

mysql

I want to dump my database with function and procedure in mysql workbench. I could dump my DB without functions and procedures.but when I try to export the data with procedures, it showed me the error like:

"mysqldump:user has insufficient privileges to show create function function name"

like image 292
Anitha Avatar asked Jun 15 '15 09:06

Anitha


People also ask

What permissions are needed for Mysqldump?

mysqldump requires at least the SELECT privilege for dumped tables, SHOW VIEW for dumped views, TRIGGER for dumped triggers, LOCK TABLES if the --single-transaction option is not used, and (as of MySQL 8.0.21) PROCESS if the --no-tablespaces option is not used.

How do I show all functions in MySQL?

Listing all functions in a MySQL database can be done using SHOW FUNCTION STATUS WHERE db = 'your_database_name'; command.


1 Answers

To dump a database also with stored procedures, you must grant SELECT rights to mysql.proc:

Execute this statement once as root:

GRANT SELECT ON mysql.proc to 'your-mysqldump-user';

Replace your-mysqldump-user with the real username.

Then flush the privileges:

FLUSH PRIVILEGES

Now you should be able to dump the database including stored procedures with your mysqldump-user.

UPDATE: as @Michael pointed out in the comments, FLUSH PRIVILEGES isn't nesseccary in this case

like image 198
itinance Avatar answered Sep 19 '22 18:09

itinance