In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains the "centOS7 mysql insert Chinese character error report how to solve", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's train of thought slowly in depth, together to study and learn "centOS7 mysql insert Chinese character error report how to solve" it!
As soon as the mysql is installed, the database abc is established, and then a new abc table is created. There is no problem with inserting English, but there is a problem with inserting Chinese, and an error will be reported:
Error 1366 (hy000): incorrect string value:'\ xe4\ xbd\ x99\ xe9\ x93\ xb6...'
It should be the database coding problem, so the database coding should be changed.
Here are two ways. One is to tap the code setting directly, and the other is to modify the file / usr/my.cnf in centos7.
The first method:
List the coding table of the database
Mysql > show variables like'% char%'
Modify the encoding format:
Mysql > set character_set_database=utf8;mysql > set character_set_server=utf8
Etc.
Just leave the original default values of character_set_filesystem and character_sets_dir unchanged, and change everything else to utf8.
Then delete the original database and create a new one, and then create a table, and you can insert it into Chinese.
The second method: modify the file / usr/my.cnf in centos7
Open the configuration file:
Vi / etc/my.cnf
Add the following under [mysqld], [mysql], [client] respectively
[mysqld] character_set_server = UTF8 [MySQL] default-character-set=utf8 [client] default-character-set=utf8
Note:
The shortcut keys used to edit the file:
Enter edit mode to edit
I
Exit edit mode
Esc
Exit the file and save
: wq
Thank you for your reading, the above is the "centOS7 mysql insert Chinese character error report how to solve" content, after the study of this article, I believe you on the centOS7 mysql insert Chinese character error report how to solve this problem has a deeper understanding, the specific use of the need for everyone to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.