ERROR 1366 (HY000): Incorrect string value: '\xC6\xF4\xD3\xC3' for column 'name' at row 1
ERROR 1366 (HY000): Incorrect string value: '\xC6\xF4\xD3\xC3' for column 'name' at row 1mysql>statusD:\mysql6.0\bin\mysql.exe Ver 14.15 Distrib 6.0.11-alpha, for Win64 (unknown)Connection id
·
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
+--------+--------------------------------
| 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("启用");
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
+--------+--------------------------------
| 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)
更多推荐
已为社区贡献1条内容
所有评论(0)