MYSQL 中文乱码 字符集utf8 下插入中文insert,select显示中文
如何使用字符集utf8,在DOS(mysql>)下,能insert中文,select也能看正常的中文?0. MySQL5.0中文问题解决方案如下:
1.在dos环境下,用mysql --default-character-set=utf8 -u root -p 这句话进入mysql~~
2.mysql> show variables like 'character\_set\_%';
character_set_client utf8
character_set_connection utf8
character_set_database utf8
character_set_results utf8
character_set_server utf8
character_set_system utf8
mysql> set character_set_results=gbk;
mysql> set character_set_client=gbk;
mysql> show variables like 'character\_set\_%';
character_set_client gbk
character_set_connection utf8
character_set_database utf8
character_set_results gbk
character_set_server utf8
character_set_system utf8
3.建数据库、表,如下:
mysql>create database demo;
mysql>use demo;
mysql>create table user ( id int(11) not null auto_increment primary key,
name varchar(100) not Null , age int)type=MyISAM,default character set utf8;
insert into user(name,age) values('本职工作',19);
insert into user(name,age) values('张工作',22);
insert into user(name,age) values('王作',29);