解决mysql不能插入中文Incorrect string value

很文博客hinven.com 数据库评论88字数 286阅读模式
广告也精彩

首先我的配置文件的设置的默认字符集是utf8即

选项default-charaset-set=utf8;文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/52613.html

然后创建一个数据表 create table a_table(b varchar(255) not null);文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/52613.html

insert into a_table values('北京');文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/52613.html

这个时候插入的是中文,系统会报告错误:Incorrect string value: '\xB1\xB1\xBE\xA9' for column 'b' at;文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/52613.html

这个不能插入中文。如果该语句写在了一个文本文件中进行批处理操作,保存的编码是默认的话也会出现这种的错误提示。文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/52613.html

解决办法:把文本文件存成utf-8格式的就可以正确执行。文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/52613.html 文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/52613.html

工具:作品在线观看

女优:最新作品观看

中文:国语在线观看

weinxin
我的微信
扫一扫更精彩
大家的支持是我更新的动力!!!
 
广告也精彩
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证