如何在mysql命令行中看到存储过程或存储函数的列表,如show tables;或显示数据库;命令。


当前回答

用这个:

SHOW PROCEDURE STATUS;

其他回答

Praveenkumar_V帖子的一个变种:

SELECT `name` FROM mysql.proc WHERE db = 'dbname' AND `type` = 'PROCEDURE';
SELECT `name` FROM mysql.proc WHERE db = 'dbname' AND `type` = 'FUNCTION';

..这是因为我在做家务之后需要节省时间:

SELECT CONCAT(
     "GRANT EXECUTE ON PROCEDURE `"
    ,`name`
    ,"` TO username@'%'; -- "
    ,`comment`
)
FROM mysql.proc
WHERE db = 'dbname'
AND `type` = 'PROCEDURE';

SELECT CONCAT(
     "GRANT EXECUTE ON FUNCTION `"
    ,`name`
    ,"` TO username@'%'; -- "
    ,`comment`
)
FROM mysql.proc
WHERE db = 'dbname'
AND `type` = 'FUNCTION';

用于视图过程的名称

select name from mysql.proc 

下面的代码用于列出所有过程,下面的代码给出与显示过程状态相同的结果

select * from mysql.proc 

用这个:

SHOW PROCEDURE STATUS;

我最喜欢呈现的程序列表的当前数据库:名称,参数列表,注释

SELECT specific_name AS name, param_list AS params, `comment`
FROM mysql.proc
WHERE db = DATABASE()
AND type = 'PROCEDURE';

为函数添加返回值:

SELECT specific_name AS name, param_list AS params, `returns`, `comment`
FROM mysql.proc
WHERE db = DATABASE()
AND type = 'FUNCTION';

选择:

SELECT * FROM INFORMATION_SCHEMA.ROUTINES