mysql数据库中文处理

ncorrect string value: '\xE5\xBC\xA0\xE6\x97\xA0...' for column 'name' at row 1

这个错误的原因就是数据库的默认编码格式为latin1,而你要将utf-8的中文插入到表中。

然后就将表的格式改为utf-8。

使用指令为:alter table stu character set utf8;

而此时表中数据的格式还是latin1,因此还要将表中出错数据的格式换为utf8

使用指令为:alter table stu change name name varchar(50) character set utf8;

大家只需要更改数据库相关数据信息就可以啦!

猜你喜欢

转载自blog.csdn.net/weixin_52188227/article/details/125790766