Skip to content

Commit

Permalink
cherry pick pingcap#4949 to master (pingcap#4952)
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

Co-authored-by: seeker <153607303@qq.com>
  • Loading branch information
ti-srebot and seeker authored Nov 25, 2020
1 parent 0732b41 commit 80dc9c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions character-set-and-collation.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ SHOW COLLATION WHERE Charset = 'utf8mb4';
2 rows in set (0.00 sec)
```

## TiDB 中的 `utf8``ut8mb4`
## TiDB 中的 `utf8``utf8mb4`

MySQL 限制字符集 `utf8` 为最多 3 个字节。这足以存储在基本多语言平面 (BMP) 中的字符,但不足以存储表情符号等字符。因此,建议改用字符集`utf8mb4`

默认情况下,TiDB 同样限制字符集 `utf8` 为最多 3 个字节,以确保 TiDB 中创建的数据可以在 MySQL 中顺利恢复。你可以禁用此功能,方法是在 TiDB 配置文件中将 `check-mb4-value-in-utf8` 的值更改为 `FALSE`

以下示例演示了在表中插入 4 字节的表情符号字符时的默认行为。`utf8` 字符集下 `INSERT` 语句不能执行,`ut8mb4` 字符集下可以执行 `INSERT` 语句:
以下示例演示了在表中插入 4 字节的表情符号字符时的默认行为。`utf8` 字符集下 `INSERT` 语句不能执行,`utf8mb4` 字符集下可以执行 `INSERT` 语句:

```sql
mysql> CREATE TABLE utf8_test (
Expand Down

0 comments on commit 80dc9c4

Please sign in to comment.