Mysql 插入中文字符报错:Incorrect string value: '\xE9\x82\xB1\xE9\x94\x90...' for column 'publisher' at row 1

报错原因:使用数据表的字段编码为 latin1

image.png

解决方法

1.先进入要操作的数据库

image.png

2.然后先查看数据表编码
show create table alltemplateentity;alltemplateentity是我的表名
image.png

3.将存放中文字符的publisher字段编码修改为utf-8
alter table alltemplateentity change publisher publisher varchar(255) character set utf8;
image.png

结束。

可以再查一下数据表编码


image.png

修改数据表的编码(alltemplateentity表名)
alter table alltemplateentity character set utf8;

你可能感兴趣的:(Mysql 插入中文字符报错:Incorrect string value: '\xE9\x82\xB1\xE9\x94\x90...' for column 'publisher' at row 1)