【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
(默认)字符集是什么:
MySQL数据库
MySQL表
MySQL专栏
#1楼
我总是只看SHOW CREATE TABLE mydatabase.mytable
。
对于数据库,您似乎需要查看SELECT DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA
。
#2楼
对于表 :
SHOW TABLE STATUS
将列出所有表。
筛选使用:
SHOW TABLE STATUS where name like 'table_123';
#3楼
对于表和列 :
show create table your_table_name
#4楼
对于数据库 :
USE your_database_name;
show variables like "character_set_database";
-- or:
-- show variables like "collation_database";
cf. 此页 。 并查看MySQL手册
#5楼
这是我的做法-
对于模式(或数据库-它们是同义词):
SELECT default_character_set_name FROM information_schema.SCHEMATA
WHERE schema_name = "schemaname";
对于表:
SELECT CCSA.character_set_name FROM information_schema.`TABLES` T,
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
WHERE CCSA.collation_name = T.table_collation
AND T.table_schema = "schemaname"
AND T.table_name = "tablename";
对于列:
SELECT character_set_name FROM information_schema.`COLUMNS`
WHERE table_schema = "schemaname"
AND table_name = "tablename"
AND column_name = "columnname";
来源:oschina
链接:https://my.oschina.net/stackoom/blog/3151580