MySQL Chinese garbled

Source: Internet
Author: User

Garbled characters occur in Chinese when MySQL databases are used in the project (are all Chinese characters changed ?) Solution:

1. unified project and database coding, the project uses UTF-8, So I unified the database coding into UTF-8

Modification Method: Modify the my. ini file in the MySQL root directory to replace default-character-set = latin with default-character-set = utf8 (note that there are two parts to replace)


2. After the modification is completed, save and exit, and restart the MySQL service (the purpose of the restart is to re-load the configuration file), and re-create the database. <Strong? Http: www.bkjia.com kf ware vc "target =" _ blank "class =" keylink "> California + 0tb21xL3hufvI58/Co7o8L3A + CjxwPjxpbWcgc3JjPQ = "http://www.2cto.com/uploadfile/Collfiles/20140419/2014041909003725.jpg" alt = "">

At this moment, the problem of Chinese garbled characters in the project has been solved!

If you query data in the background at the moment, you will find that the background (DOS) database displays garbled characters. It is strange that all codes are unified, the reason is very simple because the default encoding of the DOS window is GBK and the database is configured with UTF-8 encoding, so the solution is to tell the database that my client encoding is not UTF-8 but GBK.

Modify the database client encoding: set nemas gbk;

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.