如何检查MySQL表是否为UTF-8并具有storageEngine InnoDB?

Gee*_*Out 16 mysql innodb utf-8 storage-engines

谷歌搜索只是找到从一种格式更改为另一种格式的说明,但我似乎无法确定如何确定我先拥有哪些格式.

我怎么能够:

  1. 检查表格的字符编码是什么?
  2. 检查表使用的存储引擎是什么?
  3. 检查所有表是否都是特定编码?
  4. 检查所有表是否都有某个存储引擎?

Nic*_*ssu 31

您可以使用information_schema来了解每个表的引擎.

select table_name,engine 
from information_schema.tables
where table_schema = 'your_database'
Run Code Online (Sandbox Code Playgroud)

对于您可以使用的编码

show create table table_name
Run Code Online (Sandbox Code Playgroud)

或者,甚至更好

select 
c.character_set_name 
from information_schema.tables as t,
     information_schema.collation_character_set_applicability as c
where c.collation_name = t.table_collation
and t.table_schema = "your_db"
and t.table_name = "table_name";
Run Code Online (Sandbox Code Playgroud)