Home  >  Article  >  Database  >  What should I do if garbled characters appear in mysql database?

What should I do if garbled characters appear in mysql database?

王林
王林Original
2020-09-01 15:16:133519browse

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.

What should I do if garbled characters appear in mysql database?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn