How to delete all procedures of a database in mysql5
I want to delete all procedures from my MySQL database 开发者_开发百科sbnmaster
. How should I write a query for this?
Try this
USE sbnmaster;
SELECT CONCAT("DROP PROCEDURE IF EXISTS ",SPECIFIC_NAME) AS StorePrecedure
FROM information_schema.ROUTINES R
WHERE R.ROUTINE_TYPE = "PROCEDURE"
AND R.ROUTINE_SCHEMA = DATABASE();
Not sure that it is correct, but seems it works -
DELETE FROM mysql.proc WHERE db = 'sbnmaster' AND type = 'PROCEDURE';
精彩评论