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 in mysql

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

How to save emoji expressions in mysql, I believe many inexperienced people do not know what to do about it. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE' collation%'; query character set

SET NAMES utf8mb4; sets the data format of the current connection to utf8mb4, so that the current connection can save table symbols.

Query the character set result again

ALTER TABLE `wx_ wxuser` MODIFY COLUMN `nickname` VARCHAR (255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT 'nickname'

This is all you need to set the field to utf8mb4

SHOW FULL COLUMNS FROM wx_wxuser; displays table field details

Spring boot 2.1.6 sets the startup connection format to utf8mb4

Spring.datasource.hikari.connection-init-sql=SET NAMES utf8mb4

After testing, the default is utf8mb4, and you don't have to configure this item.

Jpa sets the generated fields to utf8mb4 format

@ Column (columnDefinition = "VARCHAR (255) CHARACTER SET utf8mb4")

Test data: Mi

Mysql my.ini configuration file, be careful not to use windows's default notepad to open, can not be saved to utf8 format, if this format, notepad++ display:

My.ini configuration:

[client] default-character-set=utf8mb4 [mysql] # set mysql client default character set default-character-set= utf8mb4 [mysqld] default_time_zone=+8:00# setting port 3306 port = 330setting mysql installation directory basedir=D:\ Program Files\ mysql-5.7.25-winx64# set mysql database data storage directory datadir=D:\ Program Files\ mysql-5.7.25-winx64\ data# allows the maximum number of connections max_connections=1000# The character set used by the server defaults to the 8-bit encoded latin1 character set character-set-server=utf8mb4collation-server = utf8mb4_unicode_ciinit_connect=SET NAMES utf8mb4#. The default storage engine that will be used when creating a new table is default-storage-engine=INNODB# to enable query cache explicit_defaults_for_timestamp=true# to enable binloglog-bin=mysql-bin-logexpire-logs-days=7max-binlog-size=500Mbinlog-format=Rowserver-id=10 to read the above. Have you mastered how to save emoji emoticons in mysql? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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

Internet Technology

Wechat

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

12
Report