Home > Database > Mysql Tutorial > 解决mysql不能插入中文Incorrect string value_MySQL

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

WBOY
Release: 2016-06-01 13:19:20
Original
956 people have browsed it

bitsCN.com 选项default-charaset-set=utf8;

然后创建一个数据表 create table a_table(b varchar(255) not null);

insert into a_table values('北京');

这个时候插入的是中文,系统会报告错误:Incorrect string value: '/xB1/xB1/xBE/xA9' for column 'b' at;

这个不能插入中文。如果该语句写在了一个文本文件中进行批处理操作,保存的编码是默认的话也会出现这种的错误提示。

解决办法:把文本文件存成utf-8格式的就可以正确执行。
bitsCN.com

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template