CHARACTER_SETS

The CHARACTER_SETS table provides information about character sets. Currently, TiDB only supports some of the character sets.

  1. USE INFORMATION_SCHEMA;
  2. DESC CHARACTER_SETS;

The output is as follows:

  1. +----------------------+-------------+------+------+---------+-------+
  2. | Field | Type | Null | Key | Default | Extra |
  3. +----------------------+-------------+------+------+---------+-------+
  4. | CHARACTER_SET_NAME | varchar(32) | YES | | NULL | |
  5. | DEFAULT_COLLATE_NAME | varchar(32) | YES | | NULL | |
  6. | DESCRIPTION | varchar(60) | YES | | NULL | |
  7. | MAXLEN | bigint(3) | YES | | NULL | |
  8. +----------------------+-------------+------+------+---------+-------+
  9. 4 rows in set (0.00 sec)

View the CHARACTER_SETS table:

  1. SELECT * FROM `CHARACTER_SETS`;

The output is as follows:

  1. +--------------------+----------------------+-------------------------------------+--------+
  2. | CHARACTER_SET_NAME | DEFAULT_COLLATE_NAME | DESCRIPTION | MAXLEN |
  3. +--------------------+----------------------+-------------------------------------+--------+
  4. | ascii | ascii_bin | US ASCII | 1 |
  5. | binary | binary | binary | 1 |
  6. | gbk | gbk_chinese_ci | Chinese Internal Code Specification | 2 |
  7. | latin1 | latin1_bin | Latin1 | 1 |
  8. | utf8 | utf8_bin | UTF-8 Unicode | 3 |
  9. | utf8mb4 | utf8mb4_bin | UTF-8 Unicode | 4 |
  10. +--------------------+----------------------+-------------------------------------+--------+
  11. 6 rows in set (0.00 sec)

The description of columns in the CHARACTER_SETS table is as follows:

  • CHARACTER_SET_NAME: The name of the character set.
  • DEFAULT_COLLATE_NAME The default collation name of the character set.
  • DESCRIPTION The description of the character set.
  • MAXLEN The maximum length required to store a character in this character set.

See also