Rename a mysql procedure

馋奶兔 提交于 2020-01-01 08:06:24

问题


Does anyone know what is the syntax for renaming a mysql stored procedure/function? Or is this even supported in MySQL? I've been googling this for several minutes...


回答1:


try this

 UPDATE `mysql`.`proc`
SET name = '<new_proc_name>',
specific_name = '<new_proc_name>'
WHERE db = '<database>' AND
  name = '<old_proc_name>';

Also note: If have granted privileges to users for this procedure you will need to update the procedure name in procs_priv as well.

UPDATE `mysql`.`procs_priv`
SET Routine_name = '<new_proc_name>'
WHERE Db = '<database>' AND
  Routine_name = '<old_proc_name>';
 FLUSH PRIVILEGES;

Source: MySQL Forums :: Newbie :: Rename Stored Procedure Syntax



来源:https://stackoverflow.com/questions/13644684/rename-a-mysql-procedure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!