如何查看MySQL数据库/表/列的字符集?
什么是(默认)字符集:
MySQL数据库
MySQL表
MySQL列
以下是我如何去做 -
对于模式:
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";
对于列 :
SHOW FULL COLUMNS FROM table_name;
对于数据库 :
USE your_database_name;
show variables like "character_set_database";
-- or:
-- show variables like "collation_database";
参看 这一页。 并检查MySQL手册
链接地址: http://www.djcxy.com/p/25119.html上一篇: How do I see what character set a MySQL database / table / column is?