linux 下 mysql支持utf8mb4 可以保存emoji
2019-02-15 本文已影响0人
___大鱼___
- 更改
/etc/mysql/my.cnf
, 添加如下内容:
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
- 重启mysql
service mysql restart
- 修改表支持utf8mb4
ALTER TABLE 表名(自行更换) CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
4.即可支持utf8mb4 快笑起来吧!