当前位置:网站首页>MySQL storage expression error
MySQL storage expression error
2022-07-07 20:52:00 【The wind continues to blow 1943】
Preface
- operating system :linux
- Database version :
8.0.27
- View version commands :
mysql -uroot -p
After logging in successfully, you can see
problem
Personal blog markdown The following error is reported after inserting the label
Error message :Incorrect string value: '\\xF0\\x9F\\x98\\x82' for column 'content' at row 1
I found out on the Internet that : In use mysql When storing emoticons , Will report a mistake , This is because Emoji The expression is 4 Bytes , and mysql Of utf-8 The code is at most 3 Bytes , So when inserting emoticons, they will not be inserted . At this time, it should be modified mysql Encoded as utf8mb4 To solve the problem .
But I am sql This has been thought of when creating the table, and the related fields are also utf8mb4, Why do you report errors
Check and solve
Through multiple queries and attempts , Found as long as you modify mysql Configuration information can solve the problem
1. stay linux Find below mysql Configuration file for my.cnf
(window by my.ini), If you can't find it, you can directly query
$ find / -name my.cnf
2. stay my.cnf
Edit
[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'
3. restart mysql service
$ service mysqld restart
mysql Variable configuration extension
1.character_set_client
It is mainly used to set the character set used by the client .
2.character_set_connection
It is mainly used to set the character set when connecting to the database , If the type of character set used to connect to the database is not specified in the program, set it according to this character set .
3.character_set_database
It is mainly used to set the encoding format of the default creation database , If the encoding format is not set when creating the database , Just follow this format .
4.character_set_filesystem
File system encoding format , Convert the file name on the operating system to this character set , Namely the character_set_client transformation character_set_filesystem, Default binary There is no conversion .
5.character_set_results
The encoding format used when the database returns to the client , If there is no indication , Use the server's default encoding format .
6.character_set_server
The default encoding format specified when the server is installed , This variable is recommended to be managed by the system itself , Don't artificially define .
7.character_set_system
The coding format used by the database system , This value has always been utf8, You don't have to set it , It's the encoding format for storage system metadata .
8.character_sets_dir
This variable is the directory where the character set is installed .
边栏推荐
- margin 等高布局
- CodeSonar网络研讨会
- Implement secondary index with Gaussian redis
- 使用高斯Redis实现二级索引
- 解决使用uni-app MediaError MediaError ErrorCode -5
- 恶魔奶爸 B1 听力最后壁垒,一鼓作气突破
- 嵌入式系统真正安全了吗?[ OneSpin如何为开发团队全面解决IC完整性问题 ]
- Nebula importer data import practice
- Codesonar enhances software reliability through innovative static analysis
- Phoenix JDBC
猜你喜欢
CodeSonar网络研讨会
复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
OneSpin 360 DV新版发布,刷新FPGA形式化验证功能体验
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
Don't fall behind! Simple and easy-to-use low code development to quickly build an intelligent management information system
ISO 26262 - 基于需求测试以外的考虑因素
Klocwork code static analysis tool
95年专注安全这一件事 沃尔沃未来聚焦智能驾驶与电气化领域安全
不落人后!简单好用的低代码开发,快速搭建智慧管理信息系统
【论文阅读】MAPS: Multi-agent Reinforcement Learning-based Portfolio Management System
随机推荐
开发那些事儿:Go加C.free释放内存,编译报错是什么原因?
SQL注入报错注入函数图文详解
Tensorflow2. How to run under x 1 Code of X
[concept of network principle]
Intelligent software analysis platform embold
恶魔奶爸 指南帖——简易版
让这个CRMEB单商户微信商城系统火起来,太好用了!
How to choose fund products? What fund is suitable to buy in July 2022?
2022年在启牛开中银股票的账户安全吗?
Onespin | solve the problems of hardware Trojan horse and security trust in IC Design
ISO 26262 - 基于需求测试以外的考虑因素
Flask1.1.4 werkzeug1.0.1 source code analysis: Routing
HDU4876ZCC loves cards(多校题)
AADL Inspector 故障树安全分析模块
easyui 日期控件清空值
How to meet the dual needs of security and confidentiality of medical devices?
Airiot helps the urban pipe gallery project, and smart IOT guards the lifeline of the city
OneSpin | 解决IC设计中的硬件木马和安全信任问题
How to choose financial products? Novice doesn't know anything
如何满足医疗设备对安全性和保密性的双重需求?