Home > Database > Mysql Tutorial > body text

Briefly describe the create routine command in mysql

Y2J
Release: 2017-05-24 13:50:58
Original
5555 people have browsed it

The following editor will bring you some instructions about mysql create routine permissions. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. 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';
Copy after login

Use spuser@'localhost' user to create a routine


delimiter go
create procedure sp_hello_world()
begin
  select 'hello world';
end 
go

delimiter ;
Copy after login

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'          |
+---------------------------------------------------------------------------------------------------------------+
Copy after login

[Related recommendations]

1. Mysql free video tutorial

2. Detailed explanation of innodb_index_stats when importing data Error prompting table primary key conflict

3. Example details innodb_autoinc_lock_mode in mysql

4. Detailed example of adding new user permissions in MySQL

##5.

Detailed example of init_connect method in mysql

The above is the detailed content of Briefly describe the create routine command in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!