解决方案:**mysql字符集设置为 utf8mb4**
### 设置 my.cnf
```
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
```
### 数据库、表、字段
```sql
ALTER DATABASE dbname CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `tbname` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `tbname` MODIFY COLUMN `colname` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
```
### PHP 数据库连接设置
设置 mysql 数据库配置文件的字符集以及校对集