Option configuration
Configuration file path:/full/path/mysql/bin/my.cnf (default =/ETC/MY.CNF)
- [client]
- Default-character-set=UTF8
- [MySQL]
- Default-character-set=UTF8
- [mysqld]
- Init_connect=' SET collation_connection = Utf8_unicode_ci '
- Init_connect=' SET NAMES UTF8 '
- Character-set-Server=UTF8
- Collation-Server=utf8_unicode_ci
- Skip-character-set-client-handshake
Note
Using the Default-character-set setting in mysqld, MySQL boot will be error-enabled.
Description
About the UTF8 character set, our domestic default choice: Utf8_general_ci instead of Utf8_unicode_ci,
The difference is in the character comparison.
See MySQL above for example:
Yes, and general? = S is True
But for Unicode? = SS is True,
In fact, their differences are mainly in German and French, so for us Chinese, general is generally used, because it is faster
If you have a higher demand for German and French comparisons, use Unicode, which is more accurate than general (more accurate in terms of comparison or sorting in German and French)
Look at this document: http://dev.mysql.com/doc/refman/5.0/e ...
In addition, UTF8_BIN_CI is also more commonly used, oh, in the character comparison, Unicode and general are not case-sensitive, so if the case is required to be sensitive, use bin
Transferred from: http://yanue.net/post-134.html
Setting the default character set through MY.CNF in MySQL Utf-8