Help Center > > FAQs> Database Parameter Modification> How Do I Use the utf8mb4 Character Set to Store Emoji in an RDS for MySQL DB Instance?

How Do I Use the utf8mb4 Character Set to Store Emoji in an RDS for MySQL DB Instance?

Updated at: May 26, 2020 GMT+08:00

Configuration

To store emoji in an RDS for MySQL DB instance, you must:

  • Ensure that the client outputs the utf8mb4 character set.
  • Ensure that the connection supports the utf8mb4 character set. For example, the JDBC connection requires MySQL Connector/J 5.1.13 or later versions. In the JDBC connection string, you are advised not to configure the characterEncoding option.
  • Configure the RDS DB instance as follows:
    • Set character_set_server to utf8mb4.

    • Select utf8mb4 for Character Set.

    • Set the character set of the configuration table to utf8mb4.

Setting the Session Character Set Through set names

If you have set characterEncoding to utf8 for the JDBC connection string, or the emoji data cannot be inserted properly after you have performed the operations in Configuration, you are advised to set the connection character set to utf8mb4 as follows:

String query = "set names utf8mb4";
stat.execute(query);

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel