Mysql database encoding Parsing

Source: Internet
Author: User

1) when compiling MySQL, a default character set is specified, which is Latin1;

(2)

When installing MySQL, you can specify a default character set in the configuration file (My. INI). If it is not specified, this value is inherited from the value specified during compilation;

(3)

When starting mysqld, you can specify a default character set in the command line parameters. If this parameter is not specified, the value inherits from the configuration in the configuration file. In this case, character_set_server is set to the default character set;
(4) When creating a new database, unless explicitly specified, the character set of this database is set to character_set_server by default;
(5) When a database is selected, character_set_database is set to the default Character Set of the database. (The database must be set correctly ---)
(6) When creating a table in the database, the default Character Set of the table is set to character_set_database, which is the default Character Set of the database;
(7) When setting a column in a table, unless explicitly specified, the default character set in this column is the default Character Set of the table.

 

Enter show variables like '% chara %' to view the character set

 

Check whether the preceding parameter (character_set_server, character_set_database) is GBK.

 

Create a database !! The default character is gbk !!

In addition

(2) modify the character set of the database

Mysql> alter database mydb character set UTF-8;
(3) create a database and specify the character set of the database
Mysql> create database mydb character set UTF-8

You can modify .,..............

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.