2团
Published on 2025-04-15 / 2 Visits
0
0

MySQL检查存储引擎及表主键检查

1. 检查存储引擎

SELECT TABLE_TYPE,ENGINE,count(*) FROM
information_schema.tables WHERE table_schema='jcdb' GROUP BY TABLE_TYPE,ENGINE;

2. 表主键检查

SELECT count(table_name)
FROM information_schema.tables 
WHERE table_schema = 'jcdb' 
AND table_name NOT IN (
    SELECT table_name 
    FROM information_schema.table_constraints 
    WHERE constraint_type = 'PRIMARY KEY'
);


Comment