如何从命令行验证我的数据库中的所有表都是 InnoDB?

mar*_*son 3 mysql command-line-interface

如何从命令行快速验证我的数据库中的所有表都是 InnoDB?

Rol*_*DBA 5

计算每个存储引擎的表

SELECT COUNT(1) table_count,engine 
FROM information_schema.tables 
WHERE table_schema NOT IN ('information_schema','mysql') 
GROUP BY engine;
Run Code Online (Sandbox Code Playgroud)

或检查每个数据库的存储引擎计数

SELECT COUNT(1) table_count,table_schema,engine 
FROM information_schema.tables 
WHERE table_schema NOT IN ('information_schema','mysql') 
GROUP BY table_schema,engine;
Run Code Online (Sandbox Code Playgroud)

或获取所有非 InnoDB 表的计数(应为 0 )

SELECT COUNT(1) table_count 
FROM information_schema.tables 
WHERE table_schema NOT IN ('information_schema','mysql') 
AND engine <> 'InnoDB';
Run Code Online (Sandbox Code Playgroud)

列出不是 InnoDB 的表名称以及该表存储的数据库

SELECT table_schema,table_name 
FROM information_schema.tables 
WHERE table_schema NOT IN ('information_schema','mysql') 
AND engine <> 'InnoDB';
Run Code Online (Sandbox Code Playgroud)