Solve the problem that MySQL cannot insert Chinese data and display garbled after inserting "pro-Test text commentary!" 】

Source: Internet
Author: User
Tags mysql client


(1) Nonsense is not much to say is the use of MySQL database when you can not input Chinese, the input of Chinese after the display is garbled!!


(2) Don't say it! Start solving the problem!

First step: Find the directory where MySQL is installed to find the My.ini file;


The second step: Use Notepad to open the My.ini file, find this place to see if Default-character-set is UTF8 is not the case instead of UTF8 can! (The previous version may not have this sentence directly added to the good!) )

# MySQL Client library initialization. [Client]port=3306[mysql]default-character-set=utf8
Step three: Enter in MySQL database cmd: show variables like '%char% '; View the encoding format of the database! This shows the picture, etc. will show the picture is changed!

The fourth step: Change the original database encoding method:

Set Character_set_database=utf8;set character_set_server=utf8;set character_set_client=gbk;set character_set_ CONNECTION=GBK;

Fifth step: Change the encoding mode:

Sixth step: Insert Chinese data to try! Ok! It can be plugged in!

Seventh Step: Resolve the garbled characters shown in the first picture when the select * from table is resolved

Change the coding method above!  Set CHARACTER_SET_RESULTS=GBK; You can display it normally!


(3) The above has been described in detail the solution! But we need to note that sometimes when we join the data, we should follow the "fourth step" "Seventh step" to solve the problem of input and display garbled!


Notable is: When we use MyEclipse, provide the DBBRowser will not appear garbled time!


Ok! I wish you success!



Solve the problem that MySQL cannot insert Chinese data and display garbled after inserting "pro-Test text commentary!" The

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.