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)