MySQL Storage emoji error (incorrect string value: ' \xf0\x9f\x98\x84\xf0\x9f) solution

Source: Internet
Author: User

1. Cause of Error:

The MySQL utf-8 code stores 2-3 bytes, while emoji is 4 bytes.

2. Workaround:

Modify the MySQL configuration file, under Windows for My.ini (Linux for my.cnf), the same content is modified.

[Client]default-character-set = Utf8mb4[mysql]default-character-set = Utf8mb4[mysqld]character-set-server = Utf8mb4collation-server = Utf8mb4_unicode_ci

3. Change the corresponding field in the database to Utf8mb4_general_ci

4. In my project, configure the database link URL to the properties file. What must be changed here is to remove the characterencoding=utf-8.

MySQL Storage emoji error (incorrect string value: ' \xf0\x9f\x98\x84\xf0\x9f) solution

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.