当前位置:网站首页>MySQL5. 7 insert Chinese data and report an error: ` incorrect string value: '\ xb8 \ XDF \ AE \ xf9 \ X80 at row 1`
MySQL5. 7 insert Chinese data and report an error: ` incorrect string value: '\ xb8 \ XDF \ AE \ xf9 \ X80 at row 1`
2022-04-23 07:12:00 【Xiaoye is stupid!】
MySQL5.7 Insert Chinese data , Report errors :Incorrect string value: ‘\xB8\xDF\xAE\xF9\x80 at row 1
- First check the character encoding of the database , Because the default download MySQL The character set of the database is
latin1
show create database < Database name >
mysql> show create database information_company;
+---------------------+------------------------------------------------------------------------------+
| Database | Create Database |
+---------------------+------------------------------------------------------------------------------+
| information_company | CREATE DATABASE `information_company` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+---------------------+------------------------------------------------------------------------------+
1 row in set (0.00 sec)
- Modify the encoding format of the database
alter database < Database name > character set utf8;
mysql> alter database information_company character set utf8;
Query OK, 1 row affected (0.00 sec)
- If you insert data without protection, you should also report an error …
- At this time we need to modify
my.ini
file - What I download is MySQL5.7
my.ini
The file defaults toC:\ProgramData\MySQL\MySQL Server 5.7
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-rj3TNplQ-1635473580693)(/picture/ProgramData.png)]
- open “my.ini”.( Try to back up before modifying ). find
[client]
Add below
default-character-set=utf8mb4
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
default-character-set=utf8mb4
- Find
[mysqld]
Add below
character-set-server=utf8mb4
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
# server_type=3
[mysqld]
character-set-server=utf8mb4
# collation-server=utf8_general_ci
-
Then copy a copy to us MySQL Installation directory ( Default installed in
C:\Program Files\MySQL\MySQL Server 5.7
)
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-Qx7veb65-1635473580696)(/picture/ The installation directory .png)] -
The last restart mysql service
Right click this computer —> management
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-DUVrCAOn-1635473580698)(/picture/ service .png)]
Type in on the keyboard mysql, find mysql service , Click restart
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-GIjS6DmP-1635473580700)(/picture/ Restart .png)]
版权声明
本文为[Xiaoye is stupid!]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230606586222.html
边栏推荐
猜你喜欢
iTOP4412 HDMI显示(4.0.3_r1)
useReducer基本用法
ViewPager2实现画廊效果执行notifyDataSetChanged后PageTransformer显示异常 界面变形问题
基于BottomNavigationView实现底部导航栏
接口幂等性问题
一款png生成webp,gif, apng,同时支持webp,gif, apng转化的工具iSparta
this. getOptions is not a function
Android清除应用缓存
Ffmpeg common commands
【2021年新书推荐】Effortless App Development with Oracle Visual Builder
随机推荐
Abnormal record-18
开篇:双指针仪表盘的识别
Itop4412 LCD backlight drive (PWM)
组件化学习(2)Arouter原理学习
【2021年新书推荐】Enterprise Application Development with C# 9 and .NET 5
oracle杀死正在执行的sql
./gradlew: Permission denied
常用于融合去重的窗口函数row_number
iTOP4412 LCD背光驱动(PWM)
oracle视图相关
Oracle索引状态查询与索引重建
iTOP4412 SurfaceFlinger(4.4.4_r1)
oracle用delete删除数据所需时间测试
MySQL笔记2_数据表
oracle中生成32位uuid
【2021年新书推荐】Learn WinUI 3.0
Abnormal record-13
MarkDown基础语法笔记
利用队列实现栈
Static interface method calls are not supported at language level ‘5‘ 异常解决