MySQL Table--检查当前实例是否有外键/视图/触发器/事件
检查当前实例是否有外键/视图/触发器/事件等
## 检查非系统数据库外视图
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');