Mysql Character Set

Source: Internet
Author: User
Character Set settings in Mysql are classified into the following levels: 1. mysql Server-level Character Set 2. database-level Character Set 3. character Set at the data table level 4. each character set at the data column level corresponds to a default sorting method. You can use charactersetcharset and collatecollation respectively.

Character Set settings in Mysql are classified into the following levels: 1. mysql Server-level Character Set 2. database-level Character Set 3. character Set at the data table level 4. the character set at the data column Level Sets a default sorting method for each character set. You can use character set charset and collate collation respectively.

Character Set settings in Mysql are classified into the following centralized levels:

1. Mysql Server-level Character Set
2. Database-level Character Set
3. Data Table-level Character Set
4. character set at the data column level

Each character set corresponds to a default sorting method. You can use character set charset and collate collation to set the database, data table, and data column. Server-level character sets and sorting methods are built-in and set during the compilation phase. You can set them through system variables, which is rarely involved.

When creating databases, data tables, and data columns, set a default utf8 Character Set and utf8_general_ci sorting method (the character set must be compatible with the sorting method ):

create database db_name character set utf8 collate utf8_general_ci;create table tbl_name (  column varchar(10) character set utf8 collate utf8_general_ci) engine = InnoDB character set utf8 collate utf8_general_ci

You can query character_sets and collations data tables in information_schema to obtain supported character sets and sorting methods.

You can also use the following statement to query:

show character set;show collation;

If the character set is not set for the data column, the character set of the data table is used by default. If the character set is not set for the data table, the character set of the database is used by default. If the character set is not set for the database, the character set of the database server is used by default.

Original article address: Mysql character set. Thank you for sharing it.

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.