ERROR 1366 (HY000): Incorrect string value: '\xC6\xF4\xD3\xC3' for column 'name' at row 1,hy000xc6
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)