Character set and collation of mysql database built

1. Character set Description:

Generally choose utf8. Here are some of the difference between utf8 and utfmb4.
utf8mb4 compatible utf8, and represent more characters than can utf8.
unicode coding region from 1 to 126 belong to the traditional utf8 area, of course utf8mb4 also compatible with this area, the following line 126 is utf8mb4 expansion area, when you need to store those characters, you only use utf8mb4, or just a waste of space.

2. Collation

Generally two types of ordering: utf_bin and utf_general_ci
bin is binary, a and A will not be treated differently.
For example, you run:
the SELECT * the FROM the Table the WHERE TXT = 'A'
then you will not find in utf8_bin txt = 'A' of the line, and you can utf8_general_ci.
utf8_general_ci is not case sensitive, and that you registered in the user name and mailbox when we should use.
utf8_general_cs case-sensitive, if the user name and the mail will be adhered to as with negative consequences
utf8_bin: binary data string for each string compiler memory. Case-sensitive, and you can store binary content
utf8_unicode_ci and utf8_general_ci no real difference of Chinese and English speaking.
utf8_general_ci proofing speed, but somewhat less accurate. (Accurate enough, building a database usually choose this)
utf8_unicode_ci high accuracy, proofreading but at a slower pace.

Guess you like

Origin blog.51cto.com/11585002/2462735