什么是(默认的)字符集:

MySQL数据库 MySQL表 MySQL列


当前回答

表:

SHOW TABLE STATUS将列出所有的表。

使用过滤:

SHOW TABLE STATUS where name like 'table_123';

其他回答

数据库:

USE your_database_name;
show variables like "character_set_database";
-- or:
-- show variables like "collation_database";

参考本页。查阅MySQL手册

要查看数据库的默认排序规则:

USE db_name;
SELECT @@character_set_database, @@collation_database;

要查看表格的排序:

SHOW TABLE STATUS where name like 'table_name';

要查看列的排序规则:

SHOW FULL COLUMNS FROM table_name;

查看表的默认字符集

SHOW CREATE TABLE table_name;

表:

SHOW TABLE STATUS将列出所有的表。

使用过滤:

SHOW TABLE STATUS where name like 'table_123';

我总是看SHOW CREATE TABLE mydatabase。mytable。

对于数据库,似乎需要查看SELECT DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA。

我是这么做的——

对于模式(或数据库-它们是同义词):

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";