在/etc下新建一个文件my.cnf,将下述内容粘贴进去,重启mysql生效
[client]
default-character-set=utf8mb4
[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
skip-character-set-client-handshake = true
[mysql]
default-character-set = utf8mb4