Mysql through MY.CNF Modify the default character set for Utf-8 methods and considerations _mysql

Source: Internet
Author: User

Option configuration

Profile path: /full/path/mysql/bin/my.cnf (default is /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

Attention

Using the Default-character-set setting in mysqld, the MySQL boot will not start without an error.

Description

About the UTF8 character set, our domestic default choice: utf8_general_ci instead utf8_unicode_ci of,

The difference is in the character contrast

Please see the example of MySQL above:

For the general, ß= S is true.

But for Unicode, the ß= SS is true,

In fact, their differences are mainly in German and French, so for us Chinese, generally use general, because more faster

If you have higher requirements for German and French comparisons, use Unicode, which is more accurate than general (in terms of German and French standards, more accurate in comparison or sorting).

Look at this document: http://dev.mysql.com/doc/refman/5.7/en/charset-unicode-sets.html

There are also utf8_bin_ci is more commonly used oh, in the character contrast, Unicode and general are not case sensitive, so if the request is sensitive to case, use bin

Summarize

The above is the entire content of this article, I hope that the study or work to bring some help, if you have questions you can message exchange.

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.