Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to save Emoji emoji and special symbols in MySQL

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report