vi /etc/my.cnf
在 [mysqld]
字段下面添加类似于这样
[mysqld]
//添加下面这三行到[mysqld]字段
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
//重启mariadb
# systemctl restart mariadb
//登陆查看下是否改变为utf-8
# mysql -u root -p
# show variables like 'char%';
# show variables like 'collation%';

---
转载请注明本文标题和链接:《配置 mariadb 以防止乱码》
发表评论