In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to solve the problem of mysql query Chinese garbled, I hope you have something to gain after reading this article, let's discuss it together!
Mysql query Chinese garbled solution: 1, find the my.ini file in the installation directory and open it; 2, change default-character-set to utf8;3, execute "alter table table name default..." Command; 4. Restart the mysql service.
This article operating environment: Windows7 system, mysql5.5 version, Dell G3 computer.
Mysql query Chinese garbled solution:
The computer was reinstalled with mysql after reinstalling the system, but when using it, it was found that after inserting Chinese data, the queried data was displayed as a question mark in Chinese.
Chinese cannot be displayed on myeclipse, on the mysql command line window, or on SQLyog.
Through the information consulted on the Internet, many friends have encountered such a problem and solved the problem. And I learned a little more because of it.
The following methods are for reference only, and do solve the problem of garbled codes in mysql.
Reason: it may be that the encoding format is not set up during installation.
Performance: the inserted Chinese data query is displayed as a question mark
Solution method
1. Find the my.ini file in the installation directory and open it.
2. Find the default-character-set inside and change it to utf8;. The table created later defaults to the utf8 encoding format.
3, however, the databases and tables that have been created need to be set up separately. Open the mysql command window
4, execute the following two commands
Alter database database name default character set utf8 collate utf8_general_ci
Alter table table name default character set utf8 collate utf8_general_ci
5. Restart the mysql service
After I have done the above steps, the inserted Chinese data is displayed normally in sqlyog and myeclipse, but what is displayed in the command window is not the simplified Chinese that we can understand, but it is no longer a question mark. Execute the following command in the mysql command window
Set character_set_database=utf8; set character_set_server=utf8; set character_set_client=gb2312; set character_set_connection=gb2312; set character_set_results=gb2312
Finally, the data checked out by the mysql command window is normal.
Attached: little knowledge of mysql
Open the cmd command window: net stop mysql-stop the mysql service
Net start mysql-start the mysql service
Be careful not to add a semicolon at the end
Open the mysql command window:
Type mysql directly in the start window to open it.
B. If you are already in the cmd window and do not want to quit, you can enter mysql-uroot-pmysql; (root for your user name and mysql for your password)
The following commands / statements can be executed in the mysql command window
A, show variables like'% char%';-view encoding settings b, show create database database name;-view the database encoding format c, show create table table name;-view the table encoding format d, show full columns from table name;-you can view the properties of the table field
After reading this article, I believe you have a certain understanding of "how to solve the problem of Chinese garbled code in mysql query". If you want to know more about it, welcome to follow the industry information channel, thank you for your reading!
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.