By default, mysql cannot correctly display Chinese characters. Enter the mysql command:
show variables like 'character_set_%';
View Character Set settings
+--------------------------+----------------------------+| Variable_name | Value |+--------------------------+----------------------------+| character_set_client | utf8 || character_set_connection | utf8 || character_set_database | latin1 || character_set_filesystem | binary || character_set_results | utf8 || character_set_server | utf8 || character_set_system | utf8 || character_sets_dir | /usr/share/mysql/charsets/ |+--------------------------+----------------------------+
The Chinese character cannot be displayed because the Value of character_set_database is latin1. Modify the command:
SET character_set_database = utf8 ;
(If the value other than filesystem is not utf8, all values are modified in this way ). After modification, check the character set configuration again to make sure that, after modification, exit mysql (quit) and restart the service, net stop mysql net start mysql re-enter mysql and then delete and re-create the previously created table. We recommend that you use the command before file backup. The method is as follows: Create a mysql. edit SQL in Notepad
Use mysql; create table students (id int unsigned not null auto_increment primary key, name char (30) not null, sex char (10) not null, age tinyint unsigned not null, tel char (13) null default "-"); insert into students values (NULL, "golden open", "male", 20, "13811371377"); insert into students (name, sex, age) values ("10 yuan", "female", 20); select * from students;
Then you will find that the Chinese characters are successfully displayed;