标签:sha 连接数 star ice ... dbn als lte cte
问题描述:mysql出现ncorrect string value: '\xF0\x9F...' for column 'XXX' at row 1
1、修改数据库的编码为utf8bm4
# vi /etc/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
init_connect='SET NAMES utf8mb4'
重启服务
systemctl restart mysqld.service
2、修改数据表的编码为utf8bm4
mysql> ALTER DATABASE DBNAME CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
mysql> ALTER TABLE TBNAME CONVERT to CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
3、修改连接数据库的连接代码
参考:
https://blog.csdn.net/fhzaitian/article/details/53168551
https://blog.csdn.net/hzw19920329/article/details/55670782
ncorrect string value: ‘\xF0\x9F...‘ for column ‘X
标签:sha 连接数 star ice ... dbn als lte cte
原文地址:http://blog.51cto.com/xiaoxiaozhou/2157263