MYSQL Insert Database error Incorrect String value: ' \xf0\xa0\x86\xa2 '

Source: Internet
Author: User
Tags mysql insert

Today, from the Nginx log analysis search keywords, and then insert the keyword into the MySQL database, the following error occurred

SQL state [HY000]; Error code [1366]; Incorrect string value: ' \xf0\xa0\x86\xa2 ' for column ' XXXX ' at row 38; Nested exception is Java.sql.SQLException:Incorrect string value: ' \xf0\xa0\x86\xa2 ' for column ' XXXX ' at row 38

The SQL that is having the problem

Then from the Internet to find the answer,

http://blog.csdn.net/fuxuejun/article/details/20361669

Originally is the MySQL database coding problem, the code from Utf-8 changed to UTF8MB4 on the line

In order to test the simple I have changed the code of the table directly.

ALTER TABLE search_key_detail CONVERT to CHARACTER SET utf8mb4;

And then insert it again, OK.

MYSQL Insert Database error Incorrect String value: ' \xf0\xa0\x86\xa2 '

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.