MySQL support emoji

Source: Internet
Author: User

1. Modify MY.CNF

[client]default-character-set = utf8mb4[mysqld]collation-server = utf8mb4_unicode_cicharacter-set-server = utf8mb4
重启mysql,检查字符集是否已经更改,除了character_set_systemcharacter_set_filesystem之外,其他的字符集都需要变成utf8mb4类型。
查看编码如下。
Mysql> Show variables like ' char% '; +--------------------------+------------------------------------------------ ------+| variable_name | Value |+--------------------------+---------------------------------------- --------------+| character_set_client | UTF8MB4 | | character_set_connection | UTF8MB4 | | Character_set_database | UTF8MB4 | | Character_set_filesystem | binary | | Character_set_results | UTF8MB4 | | Character_set_server | UTF8MB4 | | Character_set_system | UTF8 | | Character_sets_dir | /usr/local/cellar/mysql/5.5.10/share/mysql/charsets/|+--------------------------+------------------------------------------------------+ 

2. In order to support a table created previously with UTF8 also supports emoji, you will also need to modify the previous table UTF8MB4 character set

alter table posts convert to character set utf8mb4 collate utf8mb4_unicode_ci;

3. If the insertion or failure after processing is complete, do not add the characterencoding parameter on the db URL parameter. When this parameter is not added, the default value is AutoDetect.

4.mysql support emoji with version constraints, it is recommended that MySQL upgrade to 5.5,mysql-connetion upgrade to 5.1.30.

MySQL support emoji

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.