Home  >  Article  >  Operation and Maintenance  >  How to solve centos mariadb garbled problem

How to solve centos mariadb garbled problem

藏色散人
藏色散人Original
2022-01-07 16:38:482318browse

Solution to centos mariadb garbled code: 1. Add "character-set-server=utf8" under the [mysqld] label; 2. Add "default-character-set=utf8" under the [client] label ; 3. Restart the service.

How to solve centos mariadb garbled problem

The operating environment of this article: CentOS 7 system, Dell G3 computer.

How to solve the centos mariadb garbled problem?

CentOS 7 configure MariaDB (MySQL) character encoding to prevent Chinese garbled characters

[root@localhost~]# vi /etc/my.cnf  (如果不行则sudo vi /etc/my.cnf)
#在[mysqld]标签下添加
character-set-server=utf8
[root@localhost~]# vi /etc/my.cnf.d/client.cnf
#在[client]标签下添加
default-character-set=utf8

Restart

[root@localhost~]# systemctl restart mariadb
mysql -u root -p 后查看现在的字符编码
show variables like '%character%';

Recommended tutorial: "centos tutorial"

The above is the detailed content of How to solve centos mariadb garbled problem. 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