MySQL DBA - Tips and Techniques Magazine

13 Nov 2014

MySQL Privilege management for Stored Procedures and Functions

Execute permission for a Procedure or Function can be granted to Individually as shown below:

 

GRANT EXECUTE ON PROCEDURE `eonline`.`sp_getmailjoblist` TO 'eonline_rw'@'%' ;                            

GRANT EXECUTE ON FUNCTION `eonline`.`fn_getmailjobsub` TO 'eonline_rw'@'%' ;     

 

To Grant execute permission on all Procedures and Functions of a particular database say 'eonline' to a particular user say 'eonline_rw'  in this case, use the following syntax.

 

GRANT EXECUTE ON `eonline`.* TO 'eonline_rw'@'%' ;

 

This will grant the permissions for all the procedures and  functions of this database to be executed from any host. To restrict this to a particular host , hostname may be specified in the grant statement.

No comments:

Post a comment