Reputation: 37
In mysql 5.1 database, I create a table, CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;
create table users
(
Id int not null auto_increment comment '主键',
username varchar(200) character set utf8 comment '名字',
password varchar(200) character set utf8 comment '密码',
phoneno varchar(200) character set utf8 comment '电话',
note varchar(200) character set utf8 comment '备注',
primary key (Id)
);
In Mysql command line window, I cannot insert the following record. It always complain ERROR: 1366 Incorrect String Value ...
INSERT INTO users (username, password, phoneno, note) VALUES ('张三', '123456', '123456', '我是张三');
What's the issue?
I checked Mysql configuration, it works fine.
mysql> show variables like '%char%';
+--------------------------+----------------------------------------------------
-----------+
| Variable_name | Value
|
+--------------------------+----------------------------------------------------
-----------+
| character_set_client | utf8
|
| character_set_connection | utf8
|
| character_set_database | utf8
|
| character_set_filesystem | binary
|
| character_set_results | utf8
|
| character_set_server | utf8
|
| character_set_system | utf8
|
| character_sets_dir | C:\Program Files (x86)\MySQL\MySQL Server 5.1\share
\charsets\ |
+--------------------------+----------------------------------------------------
-----------+
8 rows in set (0.00 sec)
Upvotes: 1
Views: 264