1. Before practicing a Java Web project, MySQL encoding is set correctly, the server encoding is also set correctly, but when storing data to MySQL, there will be garbled problem, and later found that the MySQL and the server encoding Setup problem, the following is the MySQL directory, Copy My-default.ini the file, and named My.ini, so there are two. ini files in the root directory, one is My-default.ini, and the other is My.ini.
2. Next we just need to change the contents of the My.ini.
Add Character_set_server=utf8 under [mysqld], note that "UTF8" is not "utf-8" and there are no punctuation marks behind it;
Add three more lines after the phrase "sql_mode=no_engine_substitution,strict_trans_tables":
[Client]
port=3306
Default-character-set=utf8
[MySQL]
Default-character-set=utf8
Then look at the relevant code set for MySQL, show variables like "%char%";
Coding issues between MySQL and the server