In general, to prevent the program from garbled in the process of interaction, so the front and back of the platform will agree to the encoding format.
Because UTF-8 encoding is international, I set the encoding format UTF-8 in MySQL.
Check the MySQL encoding format first.
Show variables like ' character\_set\_% ';
Found a variety of different.
Ok! Now start the configuration:
Task Manager, stop the MySQL service.
Locate the My.ini file in the MySQL installation directory, create a new My.ini file, and copy the My-default.ini file contents to the My.ini file.
1. In profile My.ini [client] Add Default-character-set =utf8, the newly created connection on this computer will take effect immediately
2. Add Default-character-set =utf8 in Profile My.ini [mysqld], take effect after mysqld service restart
Turn on MySQL service.
3. Execute the SET statement to modify the character set, and the newly created connection to the non-native will also take effect
SET GLOBAL Character_set_client=utf8;
SET GLOBAL Character_set_connection=utf8;
SET GLOBAL Character_set_database=utf8;
SET GLOBAL Character_set_results=utf8;
SET GLOBAL Character_set_server=utf8;
Quit MySQL. Log in again. Inquire
Show variables like ' character\_set\_% ';
The encoded characters have now been corrected.