向mysql中插入富文本表情后报错
insert into `qa` (`question`) values ('')
报错信息如下
(1366, “Incorrect string value: ‘\xF0\x9F\x91\x8D\xF0\x9F…’ for column ‘post_content’ at row 1”)
mysql当前字符集不支持插入表情,需要修改字符集为 utf8mb4
执行这行命令修改数据表字符集
ALTER TABLE `表名` CONVERT TO CHARACTER SET 'utf8mb4'
# ALTER TABLE `qa` CONVERT TO CHARACTER SET 'utf8mb4'