Solve the Problem of mysql being unable to insert Chinese data and displaying garbled characters after insertion. [graphic comments for test !]

Source: Internet
Author: User

Solve the Problem of mysql being unable to insert Chinese data and displaying garbled characters after insertion. [graphic comments for test !]
(1) Not much nonsense. It means that you cannot enter Chinese characters when using the mysql database. If you can enter Chinese characters, garbled characters are displayed !!

(2) No more! Start solving the problem! Step 1: Find the mysql installation directory and find the my. ini file;

Step 2: use NotePad to open the my. ini file,

Find this location and check whether the default-character-set is utf8. If not, change it to utf8! (This sentence may not have been added in previous versions !)

# MySQL client library initialization. [client] port = 3306 [mysql] default-character-set = utf8
Step 3: Enter show variables like '% char %' in the Command box of the mysql database ';

View the encoding format of the database! The image will be displayed here. The image will be changed later!

Step 4: Change the encoding method of the original database:
Set character_set_database = utf8; set character_set_server = utf8; set character_set_client = gbk; set character_set_connection = gbk;

 

Step 5: Change the encoding method:

 

Step 6: Try inserting Chinese data! OK! Yes, it can be inserted!

 

Step 7: Solve the garbled characters shown in the first figure when selecting * from table

Change the encoding method above! Set character_set_results = gbk; it can be displayed normally!

(3) The solution has been described in detail above!

However, we need to note that sometimes we need to solve the input and display garbled characters by following the "Step 4" and "Step 7" when adding data!

It is worth noting that when using myeclipse, the provided DBBrowser will not contain garbled characters!

OK! Wish you success!

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.