Is `definer` required when creating a stored procedure?

前端 未结 3 1012
遇见更好的自我
遇见更好的自我 2021-02-02 08:54

I\'ve written all of MySQL procedures as root@localhost:

CREATE DEFINER=`root`@`localhost` PROCEDURE `p_add_user`(...)

Trouble is,

3条回答
  •  离开以前
    2021-02-02 09:25

    As stated in MySQL documentation here

    CREATE
    [DEFINER = { user | CURRENT_USER }]
    PROCEDURE sp_name ([proc_parameter[,...]])
    [characteristic ...] routine_body
    

    So, the DEFINER part is not mandatory, just CREATE PROCEDURE should work.

提交回复
热议问题