The solution to garbled characters in the mysql database: first open the "my.ini" configuration file; then add the configuration code as "default-character-set=utf8"; and finally restart the mysql service.
MySQL defaults to latin1 (actually ISO-8859-1) character set, so we need to adjust it to UTF8 character set.
(Learning video recommendation: mysql video tutorial)
Specific method:
First detect the current MySQL default character set encoding:
mysql>show variables like "%char%";
Then enter the MySQL installation directory, rename the my-default.ini file to the my.ini file and open it;
(recommended related tutorials: mysql tutorial)
Then make the following modifications:
[client]节点 default-character-set=utf8 (增加) [mysql]节点 default-character-set=utf8 (修改) [mysqld]节点 character_set_server=utf8 (修改)
After completion, just restart the mysql service.
net stop mysql net start mysql
The above is the detailed content of What should I do if garbled characters appear in mysql database?. For more information, please follow other related articles on the PHP Chinese website!