MySQL 1366错误大致描述如下
  1. SQL Error: 1366: Incorrect string value: "xE8xAFxA6xE7xBBx86…" for column "address" at row 1

解决办法:检查数据库此字段的字符集与整理字符集是否与SQL语句传递数据的字符集相同;不相同则会引发MySQL1366错误。

修改MySQL该字段的字符集与整理规则即可。假设数据表为phplamp, SQL语句的字符集为utf8,出错的字段为address:

MySQL 1366 错误解决办法
  1. #检查数据表所有字段的状态
  2. ->show full columns from phplamp;
  3. #发现address字段的Collation项非utf8,修改它!
  4. ->alter table phplamp change name name varchar(100) character set utf8 collate utf8_unicode_ci not null default '';

修改完字段的字符集后可以再使用show full columns from table_name命令检查一下,以确保万无一失。假如您的SQL字符集为GBK或是GB2312或是其它的话,只需要将数据表字段的字符集更改为其相应的编码即可。

相关文章:

  • 2021-11-03
  • 2022-12-23
  • 2021-04-27
  • 2021-07-27
  • 2022-12-23
  • 2021-08-02
  • 2021-12-18
猜你喜欢
  • 2021-12-26
  • 2021-05-01
  • 2021-12-01
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
相关资源
相似解决方案