一、修改配置文件/etc/my.cnf
vi /etc/my.cnf
在[mysqld]标签下添加
#set charact
init_connect=‘SET collation_connection = utf8_unicode_ci‘
init_connect=‘SET NAMES utf8‘
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
二、配置文件/etc/my.cnf.d/client.cnf
vi /etc/my.cnf.d/client.cnf
在[client]下添加
#set charact
default-character-set=utf8
三、配置文件/etc/my.cnf.d/mysql-clients.cnf
vi /etc/my.cnf.d/mysql-clients.cnf
在[mysql]中添加
#set charaset
default-character-set=utf8
四、重启MariaDB服务
service mariadb restart
五、查看字符集
show variables like "%character%";show variables like "%collation%";
设置完毕!