1. 启动服务
systemctl start mariadb
2. 编码配置
# 编辑/etc/my.cnf
vim /etc/my.cnf
# 在[mysqld]标签下添加下面内容
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
# 编辑/etc/my.cnf.d/client.cnf
vim /etc/my.cnf.d/client.cnf
# 在[client]标签下添加下面内容
default-character-set=utf8
# 编辑/etc/my.cnf.d/mysql-clients.cnf
vim /etc/my.cnf.d/mysql-clients.cnf
# 在[mysql]标签下添加下面内容
default-character-set=utf8
3. 重启服务
systemctl restart mariadb
# 设置开机自启动
systemctl enable mariadb
4. 查看字符集
# 登录mysql之后,键入下面内容
show variables like "%character%";
show variables like "%collation%";
# 简单的查看命令
status
参考:CentOS7安装MariaDB以及编码注意事项
网友评论