Make Mac version of MySQL support emoji emoticons

Source: Internet
Author: User

1. First introduce the following commonly used character sets
    • ASCII: United States Information Interchange standard coding; English and other Western European languages; single-byte encoding, 7-bit represents a character, a total of 128 characters.
    • GBK: Double-byte, Chinese character code expansion specification; Chinese, Japanese and Korean characters, English, numerals, double-byte encoding, a total of 21,003 Chinese characters, GB2312 extension.
    • Utf-8:unicode standard variable length character encoding, Unicode Standard (Uniform code), industry uniform standards, including the world's dozens of kinds of text system;
    • UTF-8: Encode each character using one to three bytes.
    • Utf8mb4: Stores four bytes, and the scenario is used to store the emoji expression because it can emoji four bytes of expression.
    • Utf8mb4:mysql versions > 5.5.3.
    • Other common character sets: Utf-32,utf-16,big5,latin1
2. Modify the Local database
for each of the databases:

ALTER database is here the name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

For each of the tables:

ALTER table here is the table name CONVERT to CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

3. Modify the MySQL configuration file

Go to this directory, under this directory there is a suffix .cnf file
cd/usr/local/mysql/support-files/

Copy this file to the etc directory and name my.cnf it
sudo cp my-default.cnf/etc/my.cnf

Then edit the my.cnf file and copy the contents below.

[Client]
Default-character-set = Utf8mb4

[MySQL]
Default-character-set = Utf8mb4

[Mysqld]
Character-set-client-handshake = FALSE
Character-set-server = Utf8mb4
Collation-server = Utf8mb4_unicode_ci

4. Restart MySQL

    • Start:/usr/local/mysql/support-files/mysql.server start
    • Stop:/usr/local/mysql/support-files/mysql.server stop
    • Restart:/usr/local/mysql/support-files/mysql.server restart

Service Mysqld Stop
Service mysqld Start
Service mysqld Restart

Make Mac version of MySQL support emoji emoticons

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.