2. CHARACTER_SETS
CHARACTER_SETS
表提供有关可用字符集的信息。 下表中的SHOW Name
值对应于SHOW CHARACTER SET
语句的列名。
INFORMATION_SCHEMA Name | SHOW Name | Remarks |
---|---|---|
CHARACTER_SET_NAME | Charset | |
DEFAULT_COLLATE_NAME | Default collation | |
DESCRIPTION | Description | MySQL extension |
MAXLEN | Maxlen | MySQL extension |
表CHARACTER_SETS
包含以下列:
- CHARACTER_SET_NAME:字符集名称
- DEFAULT_COLLATE_NAME:字符集默认排序规则
- DESCRIPTION:字符集的描述
- MAXLEN:存储一个字符所需的最大字节数。
示例
mysql> SELECT * FROM INFORMATION_SCHEMA.CHARACTER_SETS WHERE CHARACTER_SET_NAME LIKE 'utf8';
+--------------------+----------------------+---------------+--------+
| CHARACTER_SET_NAME | DEFAULT_COLLATE_NAME | DESCRIPTION | MAXLEN |
+--------------------+----------------------+---------------+--------+
| utf8 | utf8_general_ci | UTF-8 Unicode | 3 |
+--------------------+----------------------+---------------+--------+
1 row in set (0.00 sec)
mysql> show character set like 'utf8';
+---------+---------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------+-------------------+--------+
| utf8 | UTF-8 Unicode | utf8_general_ci | 3 |
+---------+---------------+-------------------+--------+
1 row in set (0.00 sec)