Sqlyog Chinese garbled Solution
Initial situation:
· I am using sqlyog enterprise v8.18.
· The text encoding used by eclipse is GBK by default;
While the server-installed MYSQL: mysql-essential-5.1.47-win32.msi, the specified character encoding is utf8.
When I use sqlyog to view the data tables and data generated by my JPA project, I find that Chinese data is garbled.
First judgment:
The text encoding of eclipse is inconsistent with the character encoding of MySQL database.
Modify eclipse settings, window-> preferences-> General-> workspace,
Locate text file encoding, select other, and change to UTF-8.
At this point, you need to adjust the text to the correct encoding for all the programs that use Chinese in the project. Delete the database tables and data, execute the JPA project, and regenerate the table and data.
As a result, sqlyog is used to view the data table, and garbled characters are still displayed.
Search online. solution:
· Enter the following code under sqlyog and execute all
Set character_set_client = utf8;
Set character_set_results =
Gb2312;
Set character_set_connection = utf8;
· Modify fonts in sqlyog menu tools> preference base> Editor
As a result, sqlyog is used to view the data table, and garbled characters are still displayed. The online method is not feasible!
Third judgment:
To support the complete Chinese Character Set, MySQL should be set to GBK encoding.
Find my. ini in the MySQL installation directory and change utf8 to GBK, as shown below:
Default-character-set = GBK
There are two parts to be modified.
Restart the MySQL service.
Result: The data table is displayed normally with sqlyog.
We hereby record it!