Get the App
SLTechnology News&Howtos  ›  Database  › 

How to save Emoji emoji and special symbols in MySQL

Shulou Source: shulou.com Published: 2022-06-01 18:25:48 10月05日 Update

The following is about how to save Emoji emoticons and special symbols in MySQL. The secret of the text lies in being close to the topic. So, let's skip the gossip and read the following directly. I'm sure you'll benefit from reading this article about Emoji emoticons and how to save special symbols in MySQL.

Why utf8mb4:MySQL added the encoding of this utf8mb4 after version 5.5.3. Mb4 means most bytes 4 and is designed to be compatible with four bytes of unicode. In fact, utf8mb4 is the superset solution of utf8: look at the coded character set: SHOW VARIABLES WHERE Variable_name LIKE 'character\ _ set\%' OR Variable_name LIKE 'collation%';, as shown in the following figure, "the reason why special symbols cannot be saved may be different from this article, and this article may not solve your problem."

If the value field in the result is different from the picture above, please continue to read this article; modify the database code: ALTER DATABASE database CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;; modify the data table encoding: ALTER TABLE table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;; modify table field code: ALTER TABLE table CHANGE column column VARCHAR (32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci Edit the my.ini file and add or modify the following: [client] default-character-set = utf8mb4 [MySQL] default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSEcharacter-set-server = utf8mb4collation-server = utf8mb4_unicode_ciinit_connect='SET NAMES utf8mb4' restart Mysql:service mysqld restart

Check the coded character set again. If the result is consistent with the result in the above figure, it is done.

Is there anything you don't understand about how to save Emoji emoticons and special symbols in MySQL above? Or if you want to know more about it, you can continue to follow our industry information section.

Tags: Coding special symbols emoticons results content fields characters character sets data articles different consistent done above above below below theme again Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Docker NVidia MySQL MariaDB