For example, default-character-set = utf8.
character_set_server = utf8
Restart mysql service after modification, and restart mysql service.
Use mysql & gt to display variables similar to "character%"; Check and find that the database code has been changed to utf8.
(2) There is another way to modify the default character set of mysql, which is to use mysql commands.
Generally speaking, even if the mysql default character set of the table is utf8 and the query is sent in UTF-8 code, you will find that the data stored in the database is still garbled. The problem lies in this connection layer. The solution is to execute the following statement before sending the query:
Settings? Name? utf8 '; ?
It is equivalent to the following three instructions:
Settings? Character _ set _ client? =? utf8?
Settings? Character _ set _ result? =? utf8
Settings? Character _ set _ connection? =? utf8?