今天在学习MySQL数据库时,创建了一个表格
create table jgq(
id int primary key auto_increment,
enword varchar(32) not null,
chword varchar(32) not null);
但是在插入数据时出现了以下问题,
insert into jgq (id,enword,chword) values (1,'girl','女孩');
ERROR 1366 (HY000): Incorrect string value: '\xE5\xA5\xB3\xE5\xAD\xA9' for column 'chword' at row 1
查看表信息发下如下:
mysql> show create table jgq;
+--------+--------------------------------
------------------------------------------
-+
| Table | Create Table
|
+--------+--------------------------------
------------------------------------------
-+
| jgq | CREATE TABLE `jgq` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`enword` varchar(32) NOT NULL,
`chword` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+--------+--------------------------------
mysql> create table words(
-> id int primary key auto_increment,
-> enword varchar(32) not null,
-> chword varchar(32) not null)
-> ENGINE=MyISAM DEFAULT CHARSET=utf8;
MyISAM不支持事务哦
再次插入数据:
mysql> insert into words (id,enword,chword) values (1,'girl','女孩');
Query OK, 1 row affected (0.00 sec)
这次成功了!!!
精骨强的微博:点击打开链接