Home > Database > Mysql Tutorial > body text

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

王林
Release: 2020-09-04 14:54:03
Original
3569 people have browsed it

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%";
Copy after login

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    (修改)
Copy after login

After completion, just restart the mysql service.

net stop mysql
net start mysql
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template