In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to insert and display Chinese data in MySQL database". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to insert and display Chinese data in MySQL database.
First, when installing the database, set the character set encoding to utf8.
1. The current character set is encoded as:
Servercharacterset:utf8Dbcharacterset:utf8Clientcharacterset:utf8Conn.characterset:utf8
Create the database below:
(1) insert Chinese data, the operation cannot be successful.
(2) modify the character set encoding to:
Servercharacterset:utf8Dbcharacterset:utf8Clientcharacterset:gbkConn.characterset:gbk
Insert Chinese data and display normally.
What conditions should be met for MySQL database to insert and display Chinese data normally?
Second, when installing the database, set the character set coding to gbk.
1. The current character set encoding is:
Servercharacterset:gbkDbcharacterset:gbkClientcharacterset:gbkConn.characterset:gbk
Create data under, insert Chinese data, operation is normal, display is normal.
two。 The current character set is encoded as utf8:
Servercharacterset:gbkDbcharacterset:utf8Clientcharacterset:utf8Conn.characterset:utf8
3. The current character set is encoded as utf8:
Servercharacterset:gbkDbcharacterset:gbkClientcharacterset:utf8Conn.characterset:utf8
Insert Chinese data, the operation cannot be performed.
Conclusion: in order to insert Chinese into the database normally, the following conditions must be met:
1. To set the character set to support gbk or utf8 in Chinese
two。 Set the ClientCharacterset and Conn.Characterset character sets of the database to gbk
According to the above tips, I changed:
SETcharacter_set_client=gbk;SETcharacter_set_connection=gbk
Then try to insert the database into Chinese, at this time there is no error, can be inserted but the query is garbled.
Change it finally.
SETcharacter_set_results=gbk
After this, all the problems have been solved, and can be inserted and displayed normally.
At this point, I believe you have a deeper understanding of "how to insert and display Chinese data in MySQL database". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.