1、修改数据库字符集character-set-server=utf8mb4 重启数据库生效。(/ect/my.cnf)
[mysqld]
character-set-server=utf8mb4
[mysql]
default-character-set=utf8mb4
lnmp mysql restart
2、修改database 的字符集为 utf8mb4 alter database dbname character set utf8mb4 (dbname为数据库名称)
3、修改表的字符集 为utf8mb4 ,
alter table tablename convert to character set utf8mb4 collate utf8mb4_bin;(tablename为表名字)
4、修改thinkphp application\database.config
'charset'=>'utf8mb4',