码迷,mamicode.com
首页 > 其他好文 > 详细

ERROR 1366 (HY000): Incorrect string value: '\xC6\xF4\xD3\xC3' for column 'name' at row 1

时间:2015-05-17 16:46:42      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:error 1366 hy000   mysql报错error 1366 hy   

ERROR 1366 (HY000): Incorrect string value: ‘\xC6\xF4\xD3\xC3‘ for column ‘name‘ at row 1

mysql>status
D:\mysql6.0\bin\mysql.exe  Ver 14.15 Distrib 6.0.11-alpha, for Win64 (unknown)
Connection id:          1
Current database:       bank
Current user:           root@localhost
SSL:                    Not in use
Using delimiter:        ;
Server version:         6.0.11-alpha-community MySQL Community Server (GPL)
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
TCP port:               3306
Uptime:                 5 hours 29 min 25 sec
Threads: 1  Questions: 43  Slow queries: 0  Opens: 52  Flush tables: 1  Open tables: 4  Queries per second avg: 0.2

#如上所示,所有的编码都是utf8


mysql> show create table status;
+--------+--------------------------------
| Table  | Create Table
+--------+--------------------------------
| status | CREATE TABLE `status` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
创建的status表的格式也是utf8格式的
插入数据:
mysql> insert into status(name) values("启用");
ERROR 1366 (HY000): Incorrect string value: ‘\xC6\xF4\xD3\xC3‘ for column ‘name‘ at row 1

#解决办法:
mysql> set names gbk;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into status(name) values("启用");

Query OK, 1 row affected (0.06 sec)


ERROR 1366 (HY000): Incorrect string value: '\xC6\xF4\xD3\xC3' for column 'name' at row 1

标签:error 1366 hy000   mysql报错error 1366 hy   

原文地址:http://blog.csdn.net/qq_20545159/article/details/45789543

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!