当前位置:网站首页>MySQL5.7插入中文数据,报错:`Incorrect string value: ‘\xB8\xDF\xAE\xF9\x80 at row 1`
MySQL5.7插入中文数据,报错:`Incorrect string value: ‘\xB8\xDF\xAE\xF9\x80 at row 1`
2022-04-23 06:07:00 【小叶很笨呐!】
MySQL5.7插入中文数据,报错:Incorrect string value: ‘\xB8\xDF\xAE\xF9\x80 at row 1
- 首先检查数据库的字符编码,因为默认下载的MySQL数据库的字符集为
latin1
show create database <数据库名>
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)
- 修改数据库的编码格式
alter database <数据库名> character set utf8;
mysql> alter database information_company character set utf8;
Query OK, 1 row affected (0.00 sec)
- 然后不保护以外的话插入数据应该还会报错…
- 这个时候我们就需要修改
my.ini文件 - 本人下载的是MySQL5.7
my.ini文件默认是在C:\ProgramData\MySQL\MySQL Server 5.7
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rj3TNplQ-1635473580693)(/picture/ProgramData.png)]
- 打开“my.ini”。(修改之前尽量备份)。找到
[client]在下面添加
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
- 在找到
[mysqld]在下面添加
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
-
然后拷贝一份到我们MySQL的安装目录(默认安装在
C:\Program Files\MySQL\MySQL Server 5.7)
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Qx7veb65-1635473580696)(/picture/安装目录.png)] -
最后重启mysql服务
右键此电脑 —> 管理
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-DUVrCAOn-1635473580698)(/picture/服务.png)]
在键盘上敲入mysql,找到mysql服务,点击重新启动
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-GIjS6DmP-1635473580700)(/picture/重新启动.png)]
版权声明
本文为[小叶很笨呐!]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_50957373/article/details/121029232
边栏推荐
- Abnormal record-11
- Practice using polardb and ECs to build portal websites
- How does VirtualBox modify the IP network segment assigned to the virtual machine in the "network address translation (NAT)" network mode
- Django::Did you install mysqlclient?
- pycharm Install packages failed
- Winter combat camp hands-on combat - first understand the cloud foundation, hands-on practice ECS ECS ECS novice on the road to get the mouse cloud Xiaobao backpack shadowless
- 窗口分析函数LAST_VALUE,FIRST_VALUE,lag,lead
- Abnormal record-20
- Error alarm of Postgres master-slave replication delay monitoring
- 利用栈实现队列的出队入队
猜你喜欢

Dolphinscheduler集成Flink任务踩坑记录

PG SQL截取字符串到指定字符位置

Build a cloud blog based on ECS (send blessings on the cloud Xiaobao code and draw iphone13 for free)

Dolphinscheduler配置Datax踩坑记录

Winter combat camp hands-on combat - first understand the cloud foundation, hands-on practice ECS ECS ECS novice on the road to get the mouse cloud Xiaobao backpack shadowless

Binder机制原理

qs. In the stringify interface, the input parameter is converted into a & connected string (with the application / x-www-form-urlencoded request header)

Practice using polardb and ECs to build portal websites

窗口分析函数LAST_VALUE,FIRST_VALUE,lag,lead

Static interface method calls are not supported at language level ‘5‘ 异常解决
随机推荐
RAC环境集群组件gipc无法正确识别心跳网络状态问题分析
窗口分析函数LAST_VALUE,FIRST_VALUE,lag,lead
Itop4412 HDMI display (4.0.3_r1)
oracle杀死正在执行的sql
Chaos takes you to the chaos project quickly
oracle存储过程中is和as区别
When switch case, concatenate the error case and if of the conventional judgment expression and use L
Information:2021/9/29 10:01 - Build completed with 1 error and 0 warnings in 11s 30ms Error异常处理
B站用户视频观看记录的存储方案
qs. In the stringify interface, the input parameter is converted into a & connected string (with the application / x-www-form-urlencoded request header)
Ali vector library Icon tutorial (online, download)
Dolphinscheduler集成Flink任务踩坑记录
第三篇:docker安装mysql容器(自定义端口)
RAC环境alert日志报错Drop transient type: SYSTP2JW0acnAurDgU1sBqMBryw==的排查
Chaos帶你快速上手混沌工程
useReducer基本用法
EMR Based offline data analysis - polite feedback
微服务架构核心概念
Apache SeaTunnel 2.1.0部署及踩坑
Practice using polardb and ECs to build portal websites