Encountered Chinese garbled problem, first check the database configuration with the status command, as follows:
The information for the database configuration is displayed.
You can also use show create DATABASE XXX to display the encoding settings at the time you created the databases.
In general, to create a database when you specify the encoding of the database, in Chinese, to be designated as UTF8.
Created in such a way. The default encoding for this database is UTF8. However, you may see the following error at this point:
Incorrect string value: ' \XB1\XB1\XBE\XA9 ' for column ' B ' at;
You will need to check the script format you used to create the database at this point. In the case of Notepad, the default character encoding format is ANSI, so you have to save it again with UTF-8.
At this point the JDBC program should be able to read successfully, but the console will display
Such a mess, this time, you need to typed the following command:
Set character_set_results= ' gb2312 (or GBK) ';
can be displayed normally.
2. Commands for creating a database using scripting
>source file path \ file name. sql
Solve the problem of MySQL Chinese garbled