Home >Database >Mysql Tutorial >MySQL database saves Emoji expressions and special symbols
utf8mb4
:SHOW VARIABLES WHERE Variable_name LIKE 'character \_set\_%' OR Variable_name LIKE 'collation%';
value
field in the result is different from the picture above, please continue reading this article;ALTER DATABASE database CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
;ALTER TABLE table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
;ALTER TABLE table CHANGE column column VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
;my.ini
file and add or modify the following content:[client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci init_connect='SET NAMES utf8mb4'
Mysql
:service mysqld restart
;View the encoded characters again Set, if the results are consistent with the above picture, you are done~
For more MySQL related technical articles, please visit Learn in the MySQL tutorial column!
The above is the detailed content of MySQL database saves Emoji expressions and special symbols. For more information, please follow other related articles on the PHP Chinese website!