MySQL stored in Chinese garbled solution (Windows environment)

Source: Internet
Author: User

In the project to crawl some Web page content to save to the MySQL database, when the content of the crawl contains Chinese, the console printed in Chinese is normal display, but in the database table, the display garbled.
Go to the MySQL command line and execute the following command:
Show variables like "%char%";

Find Character_set_server is latin1, to change to UTF8, you can execute the following command:
Set character_set_server= ' UTF8 ';

However, character_set_server if the default is Latin1, to permanently change, with the set command is not feasible, and change the My.ini file, there is no effect.
Permanent change scenario: in the MySQL installation file into the bin directory, double-click MySQLInstanceConfig.exe, re-walk the server configuration, but it should be noted that in the character set link, to select the third item, Character Select UTF8, (the first is the default server character set of Latin1).


When the database is saved to the database, the Chinese display is normal, when the table data from the Web page, Chinese is normal.

MySQL stored in Chinese garbled solution (Windows environment)

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.