MySQL Character Set learning

Source: Internet
Author: User
Tags naming convention

The 1.MYSQL character set includes two concepts: the character set (CHARACTER) and the checksum rule (COLLATION). A character set is used to define how MySQL stores strings, and a validation rule is used to define how MySQL compares strings. A character set is a one-to-many relationship with a validation rule.

2. Each character set should correspond to at least one validation rule, which can be viewed using the "show COLLATION like '% character set% '", for example to view the GBK character set as follows:



3. Validation Rule naming convention: They start with their associated character set name, usually including a language name, and end with "underscore" + "CI" or "cs" or "bin";
(1) _ci: Case insensitive (case insensitive)
(2) _cs: Case Sensitive (strictly case-insensitive)
(3) _bin: Two Yuan, that is, the comparison is based on the value of character encoding and language-independent.

4. The character set check rules are compared as follows:


"Error 1253 (42000): COLLATION ' gbk_chinese_ci ' is not valid for CHARACTER set ' UTF8 '" error message meaning is: Current system character set is UTF8, checksum rule gbk_chines E_ci ' is not a validation rule for the UTF8 character set, it needs to be GBK::



Case-insensitive comparisons:


Binary comparison:



MySQL Character Set learning

Related Article

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.