MySQL 学习笔记(六)—character 与 collation


A character set is a set of symbols and encodings. A collation is a set of rules for comparing characters in a character set.

collation 命名:A collation name starts with the name of the character set with which it is associated, generally followed by one or more suffixes indicating other collation characteristics. But the binary character set has a single collation, also named binary, with no suffixes.A language-specific collation includes a language name.Collation suffixes indicate whether a collation is case-sensitive, accent-sensitive(声调敏感), or kana-sensitive (or some combination thereof), or binary.For nonbinary collation names that do not specify accent sensitivity, it is determined by case sensitivity.


MySQL stores metadata in a Unicode character set, namely UTF-8. This does not cause any disruption if you never use accented or non-Latin characters. But if you do, you should be aware that metadata is in UTF-8.

The server sets the character_set_system system variable to the name of the metadata character set:


Character set issues affect not only data storage, but also communication between client programs and the MySQL server. If you want the client program to communicate with the server using a character set different from the default, you'll need to indicate which one.

There are default settings for character sets and collations at four levels: server, database, table, and column.


MySQL Server has a server character set and a server collation.They can be set explicitly at server startup on the command line or in an option file and changed at runtime.


扫描二维码关注本站微信公众号 Johngo学长
或者在微信里搜索 Johngo学长
回复 svip 获取验证码
wechat Johngo学长