MySQL Support emoji Emoticons

Source: Internet
Author: User

Let MySQL support emoji expression solution: convert MySQL encoding from UTF8 to UTF8MB4. Requires >= MySQL 5.5.3 version, (can also be detected 5.5.29) Low version does not support this character set, copy error stop MySQL Server service

Modify MY.CNF or Mysql.ini

[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
init_connect= ' SET NAMES utf8mb4 '

Restart MySQL server:service mysql restart, check the character set mysql> SHOW VARIABLES WHERE variable_name like ' character\_set\_% ' OR varia  Ble_name like ' collation% '; Modify Database Character set: ALTER db database_name CHARACTER set = UTF8MB4 COLLATE = utf8mb4_unicode_ci; Modify the character set of the table: ALTER table table_name CONVERT to CHARACTER set utf8mb4 COLLATE utf8mb4_unicode_ci; Modify the character set of a field: ALTER TABLE table_name Change column_name column_name VARCHAR (191) CHARACTER set UTF8MB4 COLLATE utf8mb4_unicode _ci; If only a field needs to modify the character set of that field, you can add the connection parameters of the server connection database connector/j, not the characterencoding parameter. When this parameter is not added, the default value is AutoDetect. #jdbc_url =jdbc:mysql://localhost:3306/user?useunicode=true&characterencoding=utf-8& Zerodatetimebehavior=converttonull Remove Characterencoding=utf-8

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.