The editor below will bring you some instructions on mysql create routine permissions. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor and take a look
1. If the user has create routine permission, then he can create procedure | function.
2. If the user creates a procedure | function, then mysql will automatically grant it the alter routine and execute permissions on the procedure | function.
3. Example:
User root creates a spuser@'localhost' user and gives it the create procedure permission
grant create routine on tempdb.* to spuser@'localhost' identified by '123456';
Use spuser@'localhost' user to create A routine
delimiter go create procedure sp_hello_world() begin select 'hello world'; end go delimiter ;
Check the permissions of spuser@'localhost' again
mysql> show grants; +---------------------------------------------------------------------------------------------------------------+ | Grants for spuser@localhost | +---------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'spuser'@'localhost' IDENTIFIED BY PASSWORD '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' | | GRANT CREATE ROUTINE ON `tempdb`.* TO 'spuser'@'localhost' | | GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `tempdb`.`sp_hello_world` TO 'spuser'@'localhost' | +---------------------------------------------------------------------------------------------------------------+
The above is the detailed content of Detailed explanation of code examples about mysql create routine permissions. For more information, please follow other related articles on the PHP Chinese website!