Ubuntu MySQL Chinese garbled solution

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.