zoukankan      html  css  js  c++  java
  • mysql create routine 权限的一些说明

    1、如果用户有create routine 权限那么他就可以创建procedure | function 。

    2、如果用户创建了procedure | function 那么mysql 会自动赋予它对procedure | function 的alter routine和execute 权限。

    3、例子:

    用户root用户创建一个spuser@'localhost'用户并对它赋予create routine 权限

    grant create routine on tempdb.* to spuser@'localhost' identified by '123456';

    用spuser@'localhost'用户去创建一个procedure 

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

    再一次查看spuser@'localhost'的权限

    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'                   |
    +---------------------------------------------------------------------------------------------------------------+
  • 相关阅读:
    Number Sequence
    不容易系列之(3)—— LELE的RPG难题
    又见回文
    统计元音
    数列
    regular expression
    野兽男孩
    GameStd
    boost and qt compile.
    kde4 + compiz只有两个桌面的问题
  • 原文地址:https://www.cnblogs.com/JiangLe/p/5813236.html
Copyright © 2011-2022 走看看