SHOW CHARACTER SET

This statement provides a static list of available character sets in TiDB. The output does not reflect any attributes of the current connection or user.

Synopsis

ShowCharsetStmt

SHOW CHARACTER SET - 图1

ShowLikeOrWhere

SHOW CHARACTER SET - 图2

  1. ShowCharsetStmt ::=
  2. "SHOW" ( ("CHARACTER" | "CHAR") "SET" | "CHARSET" ) ShowLikeOrWhere?
  3. ShowLikeOrWhere ::=
  4. "LIKE" SimpleExpr
  5. | "WHERE" Expression

Examples

  1. SHOW CHARACTER SET;
  1. +---------+---------------+-------------------+--------+
  2. | Charset | Description | Default collation | Maxlen |
  3. +---------+---------------+-------------------+--------+
  4. | utf8 | UTF-8 Unicode | utf8_bin | 3 |
  5. | utf8mb4 | UTF-8 Unicode | utf8mb4_bin | 4 |
  6. | ascii | US ASCII | ascii_bin | 1 |
  7. | latin1 | Latin1 | latin1_bin | 1 |
  8. | binary | binary | binary | 1 |
  9. +---------+---------------+-------------------+--------+
  10. 5 rows in set (0.00 sec)
  1. SHOW CHARACTER SET LIKE 'utf8%';
  1. +---------+---------------+-------------------+--------+
  2. | Charset | Description | Default collation | Maxlen |
  3. +---------+---------------+-------------------+--------+
  4. | utf8 | UTF-8 Unicode | utf8_bin | 3 |
  5. | utf8mb4 | UTF-8 Unicode | utf8mb4_bin | 4 |
  6. +---------+---------------+-------------------+--------+
  7. 2 rows in set (0.00 sec)
  1. SHOW CHARACTER SET WHERE Description='UTF-8 Unicode';
  1. +---------+---------------+-------------------+--------+
  2. | Charset | Description | Default collation | Maxlen |
  3. +---------+---------------+-------------------+--------+
  4. | utf8 | UTF-8 Unicode | utf8_bin | 3 |
  5. | utf8mb4 | UTF-8 Unicode | utf8mb4_bin | 4 |
  6. +---------+---------------+-------------------+--------+
  7. 2 rows in set (0.00 sec)

MySQL compatibility

The usage of SHOW CHARACTER SET statement in TiDB is fully compatible with MySQL. However, charsets in TiDB might have different default collations compared with MySQL. For details, refer to Compatibility with MySQL. If you find any compatibility differences, report a bug.

See also