MYSQL under XAMPP solves the Chinese garbled problem
I believe that many friends like me use the MYSQL integrated by XAMPP because it is so convenient to operate. But it does not support UTF-8 by default, we need to manually modify the configuration file my.ini
Open the XAMPP control panel and open the configuration file
Add 4 sentences to the configuration file
1 default_character_set = utf8
2 character-set-server = utf8
3 collation-server = utf8_general_ci
4 default_character_set = utf8
1st clause: default_character_set = utf8
Sentence 2 and Sentence 3
character-set-server = utf8
collation-server = utf8_general_ci
4th clause: default_character_set = utf8
Just restart MySQL, you can re-create a database to see, but the code of the database must be selected correctly
Speaking of this, by the way, I would like to mention the problem of Chinese garbled characters in MySQL on Ubuntu server
The path of the configuration file in Ubuntu is a bit different, and the content of the configuration file is also different, the following is the path
Write a configuration file with vim and add the following code at the end
[client]
default_character_set = utf8
[mysqld]
character-set-server = utf8
collation-server = utf8_general_ci
[mysql]
default_character_set = utf8
Finally restart MySQL