修改数据库配置文件my.cnf
首先更改mysql的数据编码,修改mysql的配置文件: /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
重启mysql