当前位置:网站首页>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.inifile - What I download is MySQL5.7
my.iniThe 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
边栏推荐
猜你喜欢

mysql和pgsql时间相关操作

Itop4412 HDMI display (4.4.4_r1)

Build an OSS based image sharing website - polite feedback

双指针仪表盘读数(一)

AVD Pixel_ 2_ API_ 24 is already running. If that is not the case, delete the files at C:\Users\admi

Itop4412 HDMI display (4.0.3_r1)

个人博客网站搭建

Dolphinscheduler调度spark任务踩坑记录

Encapsulate a set of project network request framework from 0

Dolphinscheduler集成Flink任务踩坑记录
随机推荐
Android room database quick start
oracle视图相关
JS 比较2个数组中不同的元素
AVD Pixel_ 2_ API_ 24 is already running. If that is not the case, delete the files at C:\Users\admi
Tiny4412 HDMI display
Binder机制原理
Antd Design Form表单检验
iTOP4412 FramebufferNativeWindow(4.0.3_r1)
常用UI控件简写名
Recyclerview batch update view: notifyitemrangeinserted, notifyitemrangeremoved, notifyitemrangechanged
Static interface method calls are not supported at language level ‘5‘ 异常解决
Oracle和mysql批量查询用户下所有表名和表名注释
MySQL notes 1_ database
Django::Did you install mysqlclient?
Handler进阶之sendMessage原理探索
Abnormal record-22
ViewPager2实现画廊效果执行notifyDataSetChanged后PageTransformer显示异常 界面变形问题
[Exynos4412][iTOP4412][Android-K]添加产品选项
Kotlin征途之data class [数据类]
MarkDown基础语法笔记