当前位置:网站首页>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 -pAfter 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 .
边栏推荐
- VMWare中虚拟机网络配置
- How to choose financial products? Novice doesn't know anything
- HDU4876ZCC loves cards(多校题)
- Don't fall behind! Simple and easy-to-use low code development to quickly build an intelligent management information system
- Numerical method for solving optimal control problem (0) -- Definition
- Validutil, "Rethinking the setting of semi supervised learning on graphs"
- Jetty:配置连接器[通俗易懂]
- Can Huatai Securities achieve Commission in case of any accident? Is it safe to open an account
- 凌云出海记 | 易点天下&华为云:推动中国电商企业品牌全球化
- 使用camunda做工作流设计,驳回操作
猜你喜欢

C语言多角度帮助你深入理解指针(1. 字符指针2. 数组指针和 指针数组 、数组传参和指针传参3. 函数指针4. 函数指针数组5. 指向函数指针数组的指针6. 回调函数)

使用枚举实现英文转盲文

Apifox interface integrated management new artifact

How to meet the dual needs of security and confidentiality of medical devices?
Codesonar enhances software reliability through innovative static analysis
Klocwork code static analysis tool

如何满足医疗设备对安全性和保密性的双重需求?

Details of C language integer and floating-point data storage in memory (including details of original code, inverse code, complement, size end storage, etc.)

Make this crmeb single merchant wechat mall system popular, so easy to use!
![Is embedded system really safe? [how does onespin comprehensively solve the IC integrity problem for the development team]](/img/af/61b384b1b6ba46aa1a6011f8a30085.png)
Is embedded system really safe? [how does onespin comprehensively solve the IC integrity problem for the development team]
随机推荐
How to choose financial products? Novice doesn't know anything
C language helps you understand pointers from multiple perspectives (1. Character pointers 2. Array pointers and pointer arrays, array parameter passing and pointer parameter passing 3. Function point
easyui 日期控件清空值
Is it safe to open a stock account at present? Can I open an account online directly.
SQL注入报错注入函数图文详解
Useful win11 tips
如何满足医疗设备对安全性和保密性的双重需求?
Referrer和Referrer-Policy简介
【网络原理的概念】
死锁的产生条件和预防处理[通俗易懂]
Dachang classic pointer written test questions
Static analysis of software defects codesonar 5.2 release
Guava multithreading, futurecallback thread calls are uneven
寫一下跳錶
How to choose fund products? What fund is suitable to buy in July 2022?
使用高斯Redis实现二级索引
恶魔奶爸 指南帖——简易版
实战:sqlserver 2008 扩展事件-XML转换为标准的table格式[通俗易懂]
I wrote a markdown command line gadget, hoping to improve the efficiency of sending documents by garden friends!
开户还得用身份证银行卡安全吗,我是小白不懂