In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about the solution to Chinese garbled code in mysql table. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
We can first check our mysql database to see if the Chinese is garbled.
Log in to the database, and then in the test database, create a table, then insert it into Chinese, and query the results. We can see that Chinese has become a question mark.
Show databases
Use test
Create table users (name varchar (50))
Insert into users values ('Zhang San')
Select * from users
Let's find out what the value of each character-related variable is.
Enter SHOW VARIABLES LIKE 'character%'
We can see that the value of character_set_database is latin1. Everyone's value may not be the same as mine, generally speaking, it should not all be utf8.
If there are multiple places that are not utf8, we need to modify the configuration file my.ini of mysql.
It is usually located in the root directory of the installation path, or under the bin of the root directory of the installation path, or under Linux / etc/my.cnf.
In my.ini:
Search for [client], modify or add default-character-set=utf8
Search for [mysqld], modify or add character-set-server=utf8
Found [mysql], modify or add default-character-set=utf8
Restart the mysql database.
You can run services.msc under Windows, find the mysql service, and restart
Under Linux, you can / etc/init.d/mysqld restart
Mine is xampp, did not add services, just click stop, and then start.
View the values of each variable
SHOW VARIABLES LIKE 'character%'
Or
Status
Test whether the code is still garbled after modification.
Create database baidujingyan
Use baidujingyan
Create table users (name varchar (50))
Insert into users values ('Zhang San')
Select * from users
You can see that our database has been able to display Chinese normally.
Thank you for reading! On the mysql table Chinese garbled solutions to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.
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.