Mysql through my. cnf to modify the default character set for UTF-8 method and precautions, my. cnfutf-8

Source: Internet
Author: User

Mysql through my. cnf to modify the default character set for UTF-8 method and precautions, my. cnfutf-8

Option Configuration

Configuration File Path: /full/path/mysql/bin/my.cnf (Default value:/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=utf8collation-server=utf8_unicode_ciskip-character-set-client-handshake

* Note:

Use default-character-set settings in mysqld. mysql startup reports an error and cannot start.

Description

For the utf8 character set, we use the following default options in China:utf8_general_ciInsteadutf8_unicode_ci,

The difference lies in character comparison.

See the example above in mysql:

For general, period = s is true.

However, for unicode, bytes = ss is true,

In fact, their differences are mainly in German and French. for Chinese, general is generally used because general is faster.

Unicode is more accurate than general if you have higher requirements for comparison between German and French (more accurate in comparison or sorting according to German and French Standards)

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

In addition, utf8_bin_ci is also commonly used. unicode and general are not case sensitive during character comparison. Therefore, if Case sensitivity is required, bin is used.

Summary

The above is all about this article. I hope to help you in your study or work. If you have any questions, please leave a message.

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.