Chinese characters are garbled when MySQL inserts data. Chinese characters are garbled when mysql inserts data.
[Question 1]
When using MySQLWorkbench to insert data, data cannot be run as long as it involves string insertion.
As follows:
Error Code: 1366. Incorrect string value: '\ xE5 \ xBC \ xA0 \ xE4 \ xB8 \ x89' for column 'name' at row 1
Question 2]
In a java file written in eclipse, you can insert statements after connecting to the database. However, the inserted Chinese characters are displayed as "???" in the database. Question mark.
Solution:
1. Use PATH = "$ PATH"/usr/local/mysql/bin on the mac terminal to access mysql.
Then, mysql-u root-p prompts you to enter the password.
After completion, enter mysql
[First, check the current mysql character set]
[Step 2: Perform settings]
[This problem is encountered during the second part of the settings. You can execute it when you change utf8 to utf8_general_ci]
[Check again]
[After all the settings are complete, restart mysql to insert Chinese characters.]
[However, my mysql does not love me. This method fails, but it should be effective for a large number of people .]
[Try other methods ............]