当前位置:网站首页>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 等高布局
- Cantata9.0 | new features
- 如何满足医疗设备对安全性和保密性的双重需求?
- 使用枚举实现英文转盲文
- ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
- MinGW MinGW-w64 TDM-GCC等工具链之间的差别与联系「建议收藏」
- 微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
- Guava multithreading, futurecallback thread calls are uneven
- Lingyun going to sea | yidiantianxia & Huawei cloud: promoting the globalization of Chinese e-commerce enterprise brands
- [award publicity] issue 22 publicity of the award list in June 2022: Community star selection | Newcomer Award | blog synchronization | recommendation Award
猜你喜欢
Cantata9.0 | 全 新 功 能
Network principle (1) - overview of basic principles
神兵利器——敏感文件发现工具
CodeSonar如何帮助无人机查找软件缺陷?
嵌入式系统真正安全了吗?[ OneSpin如何为开发团队全面解决IC完整性问题 ]
Don't fall behind! Simple and easy-to-use low code development to quickly build an intelligent management information system
Small guide for rapid formation of manipulator (12): inverse kinematics analysis
Klocwork 代码静态分析工具
Mysql子查询关键字的使用方式(exists)
使用高斯Redis实现二级索引
随机推荐
Static analysis of software defects codesonar 5.2 release
Airiot helps the urban pipe gallery project, and smart IOT guards the lifeline of the city
刚开户的能买什么股票呢?炒股账户安全吗
Codeforces 474 F. Ant colony
如何挑选基金产品?2022年7月份适合买什么基金?
Guava multithreading, futurecallback thread calls are uneven
开户还得用身份证银行卡安全吗,我是小白不懂
FTP steps for downloading files from Huawei CE switches
CodeSonar网络研讨会
C语言 整型 和 浮点型 数据在内存中存储详解(内含原码反码补码,大小端存储等详解)
Lingyun going to sea | yidiantianxia & Huawei cloud: promoting the globalization of Chinese e-commerce enterprise brands
The latest version of codesonar has improved functional security and supports Misra, c++ parsing and visualization
测量楼的高度
Update iteration summary of target detection based on deep learning (continuous update ing)
Micro service remote debug, nocalhost + rainbow micro service development second bullet
机械臂速成小指南(十一):坐标系的标准命名
备份 TiDB 集群到持久卷
Mongodb learn from simple to deep
2022如何评估与选择低代码开发平台?
取两个集合的交集