UTF8 is a three-byte character, and the Emoj expression is a four-sub-section, so you need to change the character set to UTF8MB4. The latter is compatible with UTF8.
For production libraries with existing data, the change process is as follows:
Very Important! do not operate during peak hours, otherwise the consequences of the lock table may not be predictable
- Server side: The JDBC connection needs to support Emoj, but the charset in the JDBC connection string does not support UTF8MB4. Modifying MySQL's character_set_server to UTF8MB4 requires a reboot of the instance . This way, JDBC automatically detects this parameter and remains consistent
- MySQL: will need to modify the table, with the following SQL changes. When finished, all char fields will be modified
ALTER TABLE CONVERT to CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
MySQL Production library change character set, UTF8-utf8mb4 Emoj