Resolving the "Incorrect string value" Error in MySQL for Emoji Storage
When storing tweets containing emojis like "🎶," users may encounter an error stating "Incorrect string value..." This error is caused by incompatible character encodings.
To resolve this issue, the character sets of the database and the table where the tweets are stored need to be configured to support Unicode characters. Here are the steps to follow:
Modify the MySQL Configuration File:
Find the [mysqld] section and add or modify the following lines:
Change Database and Table Character Sets:
Connect to MySQL and run the following commands:
Verify the Changes:
Run the following command to confirm the character set and collation settings:
After making these changes, the MySQL database should be able to store tweets with emojis without encountering the "Incorrect string value" error.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3