Basic Types and unified character set analysis of MySQL character sets

Source: Internet
Author: User
This article mainly describes the basic types of MySQL character sets and the actual operation methods of unified character sets. The following describes the main content of this article.

This article mainly describes the basic types of MySQL character sets and the actual operation methods of unified character sets. The following describes the main content of this article.

The following articles mainly introduce the basic types of MySQL character sets, the actual operations of the unified character set, and other related content. The following describes the related content of the MySQL character set, I hope you will bring a lot of help in your future study or work.

I. MySQL Character Set Type

MySQL servers use character sets in six key locations: client, connection, database, results, server, and system.

A. The client is the character set used by the client, which is equivalent to the following character set settings on the webpage: .

B. The connection is the MySQL Character Set setting type for connecting to the database. If php does not specify the character set type used for connecting to the database, it is set according to the default character set on the server.

C. database is the character set used by a database in the database server. If it is not specified during database creation, the character set specified during Server installation will be used.

D. results is the MySQL character set used by the database to return data to the client. If not specified, use the default Character Set of the server.

E. server is the default character set specified during server installation.

F and system are character set used by the database system.

PS:

1. system is generally the UTF-8 character set by default, and server is the highest character set. databases are set according to the character set of server if they are not set separately. Others are set according to server settings.

2. each table and field in the database also has the character set concept. Generally, the character set is determined based on the upper-level structure. For example, the table determines its character set according to the database settings, the field determines its character set based on the table.

Ii. Uniform Character Set Method: (install with UTF-8 character set)

1. The complete solution to the character set is to enable MySQL to use the UTF-8 character set during installation (latin1 by default), so that the encoding of the preceding six key points is UTF-8.

2. Run the STATUS command to view the STATUS of various character sets in MySQL.

You can also use show variables like 'character _ set _ % 'to view some settings of the MySQL character set.

3. If MySQL sets the character set to latin1 during installation

You can specify the utf8 character set when creating a database.
The Code is as follows:
Create database qss default character set utf8 COLLATE utf8_general_ci;

The above content is a summary of the MySQL character set. I hope you will get something.

The above content is a summary of the MySQL Character Set, hoping to help you in this regard.

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.