How to solve centos mariadb garbled problem

藏色散人
Release: 2022-01-07 16:38:48
Original
2303 people have browsed it

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
Copy after login

Restart

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

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!