MySQL client output window display Chinese garbled Problem Solution
Recently, it was found that when querying table data in the MySQL dos client output window, Chinese data in the table is displayed as garbled characters, as shown in:
Check the cause on the Internet: Garbled characters are displayed because the character encoding used in the output window of the MySQL client is incorrect. You can run the following command to view the character encoding used in the output window:
Show variables like 'Char % ';
After the command is executed, the result is shown as follows:
We can see that the utf8 character encoding is used to display Chinese data. However, because the operating system is a Chinese operating system, the default character set is GB2312, therefore, you must change the character encoding used in the output window to gb2312 to display Chinese characters normally. Use the following command to set the character encoding used in the output window:
Set character_set_results = gb2312;
After the command is executed, you can change the character encoding used in the output window to gb2312, as shown in:
Now we can run the query again to display the Chinese data in the table, as shown in:
This article permanently updates the link address: