美文网首页
CentOS7 安装MariaDB后设置UTF8

CentOS7 安装MariaDB后设置UTF8

作者: LeeSpringFly | 来源:发表于2018-03-15 15:44 被阅读0次

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以及编码注意事项

相关文章

网友评论

      本文标题:CentOS7 安装MariaDB后设置UTF8

      本文链接:https://www.haomeiwen.com/subject/ivyhqftx.html