ERROR 1366 (HY000): Incorrect string value: '\xD5\xC5\xC8\xFD' for column 'name'

 at row 1
 
数据库字符集问题,查看数据库状态:
mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.6.12, for Win32 (x86)
 
Connection id:          25
Current database:       information_schema
Current user:           root@localhost
SSL:                    Not in use
Using delimiter:        ;
Server version:         5.6.12 MySQL Community Server (GPL)
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    gbk
Conn.  characterset:    gbk
TCP port:               3306
Uptime:                 8 hours 54 min 47 sec
 
Threads: 1  Questions: 372  Slow queries: 0  Opens: 108  Flush tables: 1  Open t
ables: 62  Queries per second avg: 0.011
--------------
我要使用的库test的字符集是latin1,该字符集不支持中文字符。
查看表引擎状态:
mysql> show create table ttt;
+-------+-----------------------------------------------------------------------
-----------------------------------------------------------------------+
| Table | Create Table
                                                                      |
+-------+-----------------------------------------------------------------------
-----------------------------------------------------------------------+
| ttt   | CREATE TABLE `ttt` (
  `id` int(11) NOT NULL,
  `name` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+-----------------------------------------------------------------------
-----------------------------------------------------------------------+
修改表字符集:
mysql> alter table ttt character set utf8;
Query OK, 0 rows affected (0.10 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
mysql> show create table ttt;
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
----------+
| Table | Create Table
 
          |
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
----------+
| ttt   | CREATE TABLE `ttt` (
  `id` int(11) NOT NULL,
  `name` varchar(20) CHARACTER SET latin1 DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
----------+
修改字段字符集:
mysql> alter table ttt modify name varchar(20) character set utf8;
Query OK, 0 rows affected (1.01 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
mysql> show create table ttt;
+-------+-----------------------------------------------------------------------
---------------------------------------------------------------------+
| Table | Create Table
                                                                    |
+-------+-----------------------------------------------------------------------
---------------------------------------------------------------------+
| ttt   | CREATE TABLE `ttt` (
  `id` int(11) NOT NULL,
  `name` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+-----------------------------------------------------------------------
---------------------------------------------------------------------+
1 row in set (0.02 sec)
 
OK!
转载出处   http://blog.sina.com.cn/s/blog_8f7940400101by3u.html

ERROR 1366 (HY000): Incorrect string value: '\xD5\xC5\xC8\xFD' for column 'name' at row 1的更多相关文章

  1. mysql DOS中中文乱码 ERROR 1366 (HY000): Incorrect string value: '\xC4\xEA\xBC\xB6' for column 'xxx' at row 1

    问题:ERROR (HY000): Incorrect string value: 在DOS中插入或查询中文出现乱码 登入mysql,输入命令:show variables like '%char%' ...

  2. ERROR 1366 (HY000): Incorrect string value: '\xD6\xD0\xCE\xC4' for column XXX at row 1

    本错误为:该列的插入格式有误 修改该表中该列的字符集为utf-8 网上办法: )不能插入中文解决办法: 向表中插入中文然后有错误. mysql> insert into users values ...

  3. mysql 插入中文时出现ERROR 1366 (HY000): Incorrect string value: '\xC0\xEE\xCB\xC4' for column 'usern ame' at row 1

    1 环境: MySQL Server 6.0  命令行工具 2 问题 :  插入中文字符数据出现如下错误: ERROR 1366 (HY000): Incorrect string value: '\ ...

  4. ERROR 1366 (HY000): Incorrect string value: '\xB3\xA4\xC9\xB3' for column

    在用以下方法之前,请先执行下面命令查看. show variables like 'character%';  ——查看所有编码方式 show create table table_name;   — ...

  5. mysql insert中文乱码无法插入ERROR 1366 (HY000): Incorrect string value

    ERROR 1366 (HY000): Incorrect string value: '\xB1\xEA\xCC\xE2\xD5\xE2...' for column 'title' at row ...

  6. Linux MySQl 5.7.17 MySQL ERROR 1366(HY000):Incorrect string value 解决方法

    MySQL ERROR 1366(HY000):Incorrect string value,在往数据库中插入中文的时候会出现. 这也就是编码问题,网上大部分都是说设置下配置文件中的设置,而可悲的是在 ...

  7. Mysql插入中文时提示:ERROR 1366 (HY000): Incorrect string value: '\xE5\x8F\xB0\xE5\xBC\x8F...' fo

    Mysql插入数据时提示:ERROR 1366 (HY000): Incorrect string value: ‘\xE5\x8F\xB0\xE5\xBC\x8F…’ fo 分析如下: 首先通过语句 ...

  8. MySQL ERROR 1366(HY000) Incorrect string value

    有以下两张表: mysql> show tables; +---------------+ | Tables_in_old | +---------------+ | book | | pres ...

  9. ERROR 1366 (HY000): Incorrect string value: '\xE9\x83\x91\xE5\xB7\x9E' for column 'aa' at row 1 MySQL 字符集

    ERROR 1366 (HY000): Incorrect string value: '\xE9\x83\x91\xE5\xB7\x9E' for column 'aa' at row 1创建表之后 ...

随机推荐

  1. BP神经网络分类应用

    DNA序列分类  作为研究DNA序列结构的尝试,提出以下对序列集合进行分类的问题:有20个已知类别的人工制造序列,其中序列标号1-10为A类,11-20为B类.请从中提取特征,构造分类方法,并用这些已 ...

  2. replace all

    OPTION COPY OUTREC FINDREP=(INOUT=(X'0E',X'400E', X'0F',X'0F40'))

  3. WordPress使用自定义文章类型实现任意模板的方法和怎么做邮件回复

    主要就是使用了register_post_type 函数. 1.创建插件目录 新建一个文件夹用来存放插件文件,这里我就命名这个文件夹为myMood 2.创php代码文件 在刚才创建的文件夹里面新建一个 ...

  4. Mybatis自查询递归查找子菜单

    之前写过 java从数据库读取菜单,递归生成菜单树 今天才发现mybatis也可以递归查询子菜单 先看一下数据库 主键id,名称name,父id,和url 设计菜单类 public class Men ...

  5. python 临时修改模块搜索路径

  6. 每天一个linux命令(2): nl命令

    0.学习时间 2014-05-16 1.命令格式 nl [参数] 文件名 (文件名也缺省的情况下, 从标准输入中读入) 2.命令参数 -b t 空行不加行号(默认) -b a  空行也加行号(类似于c ...

  7. mysql的执行计划概念说明

    explain中的列的说明 1. id列 id列的编号是 select 的序列号,有几个 select 就有几个id,并且id的顺序是按 select 出现的 顺序增长的. id列越大执行优先级越高, ...

  8. python HTTP请求过程

  9. python 自主控制异常:用户自定义异常

  10. vue vscode属性标签不换行

    "vetur.format.defaultFormatterOptions": { "js-beautify-html": { "wrap_attri ...