当前位置:Gxlcms > 数据库问题 > MySQL Table--检查当前实例是否有外键/视图/触发器/事件

MySQL Table--检查当前实例是否有外键/视图/触发器/事件

时间:2021-07-01 10:21:17 帮助过:5人阅读

检查当前实例是否有外键/视图/触发器/事件等

## 检查非系统数据库外视图
SELECT * 
FROM information_schema.views
WHERE TABLE_SCHEMA NOT IN(‘information_schema‘,‘sys‘,‘performance_schema‘,‘mysql‘);


## 检查非系统数据库外触发器
SELECT * 
FROM information_schema.TRIGGERS
WHERE TRIGGER_SCHEMA NOT IN(‘information_schema‘,‘sys‘,‘performance_schema‘,‘mysql‘);

## 检查非系统数据库外外键
SELECT * 
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA IN(‘information_schema‘,‘sys‘,‘performance_schema‘,‘mysql‘);

## 检查非系统数据库外事件
SELECT * 
FROM information_schema.EVENTS
WHERE EVENT_SCHEMA NOT IN(‘information_schema‘,‘sys‘,‘performance_schema‘,‘mysql‘);

MySQL Table--检查当前实例是否有外键/视图/触发器/事件

标签:not   orm   schema   views   where   constrain   trigger   format   系统   

人气教程排行