MySQL Chinese characters are prone to garbled characters

Source: Internet
Author: User

 

The cause of this problem is probably the encoding of the database.

 

1. Enter the command line in MySQL:

 
Show variables like 'character _ SET _ % ';

 

You can see your encoding settings:

 

 

 

2. You can see which one represents the magic horse by following the command line below to change all the characters you want, for example:

 

SetCharacter_set_client=Utf8;//Set the character of the client to utf8SetCharacter_set_results=Gb2312;//Set the character set of the query result to gb2312.SetCharacter_set_connection=GBK;//Set the character set to GBK.

 

 

3 important remarks

If the previous character is character a and the expected character is not set, the table is created.
Later, the default character "A" in the database is changed to the character "B" You want (just like the above command line ).
The characters in the previous table are alsoThe expected character B is set in navicat (you can search for it on the Internet), but it does not take effect.You only need to delete the old table and create a new table.

It is suspected that the navicat setting is weak and does not take effect for the character setting of the table!

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.