• 环境基于Centos7.6

1.作用

存储过程需要proc表中的mysql数据库。

此表是在MySQL安装过程中创建的。如果要从早期版本升级到MySQL5.7,请确保更新授权表以确保proc表存在。

服务器操作mysql.proc表以响应创建、更改或删除存储过程的语句。

2.详解

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
-- 查看指定时间段创建存储过程
show PROCEDURE status where created between '2017-02-17 00:00:00'
and '2017-02-17 23:59:59';

用系统表mysql.proc来查看:
-- 查看所有的存储过程信息
select * from mysql.proc;

-- 查看特定数据库里的存储过程
select * from mysql.proc where db='test';

-- 查看某个用户定义的存储过程
select * from mysql.proc where definer='root@localhost';

-- 查看某时间段创建的存储过程
select * from mysql.proc where created between '2017-02-17 00:00:00'
and '2017-02-17 23:59:59';

-- 查看所有的存储过程
show PROCEDURE status;
-- 查看特定数据库存储过程
show PROCEDURE status where db='test';

-- 用指定的登录名查看该用户创建的存储过程
show PROCEDURE status where definer='root@localhost'; -- @localhost为用户登录位置(本地登录)