vyo9ya
Last Updated: February 25, 2016
·
190
· buithehoa

View the Character Sets of MySQL Schemas, Tables or Columns

Schemas

SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "<schema_name>";

Tables

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 = "<schema_name>"
  AND T.table_name = "<table_name>";

Columns

SELECT character_set_name FROM information_schema.`COLUMNS` C
WHERE
  table_schema = "<schema_name>"
  AND table_name = "<table_name>"
  AND column_name = "<column_name>";