当前位置:网站首页>Why MySQL cannot insert Chinese data in CMD
Why MySQL cannot insert Chinese data in CMD
2022-06-28 08:13:00 【Mediocrity and laziness】
The following is a link to my blog , This article is just a note , If you need to see the detailed process, it is recommended to move to the original blog
https://www.cnblogs.com/1102whw/p/7815466.html
https://www.iteye.com/blog/lwjlaser-1013071
I've been learning about databases recently , But with cmd There was a problem during the operation , When I use the insert statement, I always report an error , There is no problem with other statements , And the error lies in the Chinese data .
This is power shell Results of running on , It's obviously a Chinese problem , So I checked and found that there was a problem with the command line encoding format ,cmd The default is gbk. So I will cmd The encoding format of is changed to utf-8, This method is found in my blog . But the problem is not solved .


You can see my cmd It's been replaced utf-8 But there are still problems when using insert statements . Just when I was puzzled, I found a big guy's blog , The perfect solution to my problem , Finally, I will release the address , Here, take notes first .
1. View the... Under the database installation directory my.ini file , Check whether the red box is "yes" utf-8 The format of , Here you can see that mine is OK .

2. Use the following command to view the encoding format of your database
$ show variables like ‘%char%’;

You can see that everything here is utf-8 The format of , It should be a success , But I'm doing it insert The previous error is reported when the statement , The reason is that all evil cmd!!! Although I will cmd The encoding format of is changed to utf-8 however cmd The Chinese input is still gbk, So the Chinese input cannot be recognized , I'm really getting rich .
3. because cmd The input encoding cannot be changed , So we can only change our coding format to gbk, Use the following statement
$ set names gbk;
Here we are talking about the database character set , Which is related to the server side :database、server、system( It can never be modified , Namely utf-8); Related to the client :connection、client、results

Although it can solve the problem, I personally do not recommend , because gbk Only Chinese can be displayed , What if the whole Japanese and Korean ? So we will never make do with , You have to use utf-8, So I suggest you use navicat, Easy to use and powerful , It's all said .
边栏推荐
- Do you know TCP protocol (1)?
- Host is not allowed to connect to this MySQL server
- Redis cluster deployment and application scenarios
- 【学习笔记】搜索
- LeetCode之三步问题
- Airflow2.1.1 summary of the pits stepped on in actual combat!!
- B_QuRT_User_Guide(29)
- Configuring MySQL multi instance master-slave synchronization for Linux
- Is it reliable to open a new bond registration account? Is it safe?
- Unity gets the coordinate point in front of the current object at a certain angle and distance
猜你喜欢

Redis cerebral fissure

ZYNQ_ IIC read / write m24m01 record board status

Soft test -- software designer -- database design of afternoon questions

关于如何在placeholder中使用字体图标

Airflow2 configuration windows azure SSO details based on oauth2 protocol

Jenkins' common build trigger and hook services (V)

Image translation /transformer:ittr: unpaired image to image translation with transformers

Activity隐式跳转

MySQL row format parsing

Devops Basics: Jenkins deployment and use (I)
随机推荐
同花顺注册开户靠谱吗?安全吗?
B_QuRT_User_Guide(30)
Software design of power control board
挖财注册开户靠谱吗?安全吗?
【学习笔记】最短路 +生成树
匿名页的反向映射
Study notes 22/1/10
2022第六季完美童模 佛山赛区 初赛圆满落幕
cuda和cudnn和tensorrt的理解
Dataset filling data, and the use of rows and columns
Connaissez - vous le protocole TCP (2)?
Prometheus deployment alarm docking QQ mailbox
设置网页的标题部分的图标
Image translation /transformer:ittr: unpaired image to image translation with transformers
B_ QuRT_ User_ Guide(29)
块级元素上下左右居中的两个小技巧
Airflow2 configuration windows azure SSO details based on oauth2 protocol
MySQL tablespace parsing
Unity - Pico开发 输入系统等相关API的使用---C#篇
asp. Net error "/" server error in the application. String or binary data would be truncated. The statement...