zoukankan      html  css  js  c++  java
  • mysql 错误 SQL Error: 1366: Incorrect string value: "xE8xAFxA6xE7xBBx86…" for column "address" a

    在查MySQL 1366的错误原因时,发现一些有趣的回答。地址为:http://zhidao.baidu.com/question/59029575.html

    不过,还是有人给出了比较好的解决方法:

    1. MySQL 1366错误大致描述如下  
    2.   
    3.    1. SQL Error: 1366: Incorrect string value: "xE8xAFxA6xE7xBBx86…" for column "address" at row 1  
    4.   
    5. 解决办法:检查数据库此字段的字符集与整理字符集是否与SQL语句传递数据的字符集相同;不相同则会引发MySQL1366错误。  
    6.   
    7. 修改MySQL该字段的字符集与整理规则即可。假设数据表为phplamp, SQL语句的字符集为utf8,出错的字段为address:  
    8. MySQL 1366 错误解决办法  
    9.   
    10.    1. #检查数据表所有字段的状态  
    11.    2. ->show full columns from phplamp;  
    12.    3. #发现address字段的Collation项非utf8,修改它!  
    13.    4. ->alter table phplamp change name name varchar(100) character set utf8 collate utf8_unicode_ci not null default '';  
    14.   
    15. 修改完字段的字符集后可以再使用show full columns from table_name命令检查一下,以确保万无一失。假如您的SQL字符集为GBK或是GB2312或是其它的话,只需要将数据表字段的字符集更改为其相应的编码即可。  
    16.   
    17. 再送上一个MySQL的命令:  
    18. 修改数据表的字符集与整理  
    19.   
    20.    1. ->show full columns from table_name;  

    ------------------------------------------------------------------------

    本人自己修改的方式很简单,直接修改mysql的安装文件下my.ini文件中的default-character-set=gbk就ok了。

  • 相关阅读:
    [ USACO 2018 OPEN ] Out of Sorts (Platinum)
    [ USACO 2018 OPEN ] Out of Sorts (Gold)
    [ USACO 2018 OPEN ] Out of Sorts (Silver)
    [ BZOJ 4236 ] JOIOJI
    [ HAOI 2012 ] 容易题
    [ HAOI 2008 ] 玩具取名
    「BZOJ 4502」串
    Codeforces 493 E.Devu and Birthday Celebration
    「TJOI 2018」教科书般的亵渎
    「TJOI 2018」游园会 Party
  • 原文地址:https://www.cnblogs.com/hao66/p/6867214.html
Copyright © 2011-2022 走看看