网站建设资讯

NEWS

网站建设资讯

如何在MySQL元数据库里查看索引,约束,触发器,存储过程和事件的相关信息

-- 查看主键约束
SELECT * FROM information_schema.`TABLE_CONSTRAINTS`;


-- 查看外键约束
SELECT * FROM information_schema.`REFERENTIAL_CONSTRAINTS`;


-- 查看表权限信息
SELECT * FROM information_schema.`TABLE_PRIVILEGES`;


-- 查看所有列DML权限信息
SELECT * FROM information_schema.`COLUMN_PRIVILEGES`;


-- 查看表索引信息
SELECT * FROM information_schema.`STATISTICS`;


-- 查看用户权限信息
SELECT * FROM information_schema.`USER_PRIVILEGES`;
 
-- 查看触发器
SELECT * FROM information_schema.`TRIGGERS`;


-- 查看视图
SELECT * FROM `information_schema`.`VIEWS`;


-- 查看存储过程或存储函数
SELECT * FROM `information_schema`.`ROUTINES`;


--查看事件信息
SELECT * FROM information_schema.events;


备注:查看Events是否开启:
MySQL> select @@global.event_scheduler;
mysql> show variables like 'event_scheduler';

分享题目:如何在MySQL元数据库里查看索引,约束,触发器,存储过程和事件的相关信息
URL标题:http://cdweb.net/article/poihhs.html