MySql character set learning and MySql character set learning

Source: Internet
Author: User

MySql character set learning and MySql character set learning

1. MySql CHARACTER set includes two concepts: CHARACTER set (CHARACTER) and validation rule (COLLATION. Character set is used to define the way MySql stores strings; validation rules are used to define the way MySql compares strings. Character Set and verification rules are one-to-multiple relationships.

2. Each character set should correspond to at least one verification rule. You can view it using "show collation like '% Character Set %'". For example, you can view the following verification rules for the GBK character set:



3. naming Conventions for verification rules: they start with the relevant Character Set Name, usually including a language name, and end with "underline" + "ci", "cs" or "bin;
(1) _ ci: Case Insensitive (Case Insensitive)
(2) _ cs: case sensitive (case sensitive)
(3) _ bin: binary, that is, the comparison is based on the character encoding value and has nothing to do with the language.

4. Comparison of character set verification rules:


"ERROR 1253 (42000): COLLATION 'gbk _ chinese_ci 'is not valid for character set 'utf8'" indicates that the current system character set is utf8, the verification rule gbk_chinese_ci 'is not the verification rule of the utf8 character set. You must set the character set to gbk ::



Case-insensitive comparison:


Binary comparison:



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.