Home > Database > Mysql Tutorial > MySQL的Incorrect string value问题

MySQL的Incorrect string value问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:00:22
Original
1097 people have browsed it

在MySQL中手动用命令建立了一张表,在页面上添加中文记录的时候抛出类似于incorrect string value:

在MySQL中手动用命令建立了一张表,在页面上添加中文记录的时候抛出类似于incorrect string value:'\\xBB\\xF0\\xD0\\xC7' for column 1 row...的异常信息,添加英文的记录一切正常。

原因在于建表的字符串编码于页面上的字符串编码不一致导致的。

用命令show create table t_info;可以看到表t_info的编码CHARSET=LATIN1,

解决方法drop table t_info, 然后再创建改表的语句之后加上

ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=gb2312;

当然这个语句不写会根据安装时的设置默认设置,,如果遇到该类问题,应该就是表的字符集问题。

linux

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