One way to see it on the CSDN:
http://blog.csdn.net/zht666/article/details/8783396
In fact, when creating the database, specify the default encoding, I tried on my computer, and found that it automatically generated the command is:
CREATE SCHEMA ' New_schema ' DEFAULT CHARACTER SET UTF8;
So the code for my new database on the command line is:
Create database default character UTF8;
Here are my insert and query results:
Mysql> Select Database (); +------------+| Database () |+------------+| Lamp_test |+------------+1 row in Set (0.00 sec) mysql> Show tables;+---------------------+| Tables_in_lamp_test |+---------------------+| Student |+---------------------+1 row in Set (0.00 sec) mysql> desc student;+-------+------------------+---- --+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+------------------+------+-----+---------+-------+| name | varchar (15) | NO | | NULL | || Age | Int (Ten) unsigned | NO | | NULL | || sex | varchar (5) | NO | | NULL | |+-------+------------------+------+-----+---------+-------+3 rows in Set (0.00 sec) mysql> INSERT into student Values #插入中文 (' Small Code ', 23, ' Male '); Query OK, 1 row affected (0.06 sec) mysql> select * from student; #显示中文 +-----------+-----+-----+| name | Age | Sex |+-----------+-----+-----+| Small code | 23 | Male | Normal Display +-----------+-----+-----+1 row in Set (0.00 sec) mysql>
Ubuntu MySQL Chinese garbled solution