CHARACTER_SETS

CHARACTER_SETS 表提供字符集相关的信息。TiDB 目前仅支持部分字符集。

  1. USE INFORMATION_SCHEMA;
  2. DESC CHARACTER_SETS;

输出结果如下:

  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)

查看 CHARACTER_SETS 表的信息:

  1. SELECT * FROM `CHARACTER_SETS`;

输出结果如下:

  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)

CHARACTER_SETS 表中列的含义如下:

  • CHARACTER_SET_NAME:字符集名称
  • DEFAULT_COLLATE_NAME:字符集的默认排序规则名称
  • DESCRIPTION:字符集的描述信息
  • MAXLEN:该字符集存储一个字符所需要的最大字节数

另请参阅