Drop all stored procedures in MySQL or using temporary stored procedures

后端 未结 7 2061
逝去的感伤
逝去的感伤 2020-12-13 20:39

Is there a statement that can drop all stored procedures in MySQL? Alternatively (if the first one is not possible), is there such thing as temporary stored procedures in My

7条回答
  •  星月不相逢
    2020-12-13 20:57

    after the select statement which creates a list of the statements needed to drop all stored procedures and functions. You can avoid the manual work of copy pasting the listed queries as follows:

    mysql>SELECT
        CONCAT('DROP ',ROUTINE_TYPE,' `',ROUTINE_SCHEMA,'`.`',ROUTINE_NAME,'`;') as stmt
    FROM information_schema.ROUTINES into outfile '/tmp/a.txt';
    
    mysql> source /tmp/a.txt;
    

提交回复
热议问题