归档文章 (2011-2017)

date
2017/03/01

一、安装 MariaDB

1.添加 MariaDB Yum 源

cat >/etc/yum.repos.d/MariaDB.repo<<'EOF' [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF

2.安装 MariaDB

sudo yum install -y MariaDB-server MariaDB-client

3.启动 MariaDB

sudo systemctl start mariadb sudo systemctl enable mariadb

二、设置 MariaDB

mysql_secure_installation
notion imagenotion image
install-mariadb-centos7
  1. 初始密码为空,直接回车。
  1. 设置 root 密码
  1. 是否移除匿名用户
  1. 是否禁止 root 远程登录
  1. 是否删除 ‘test’ 测试数据库

三、测试 MariaDB

mysqladmin -u root -p version
notion imagenotion image
install-mariadb-centos7-2

四、解决 MariaDB 中文乱码

[client] ... default-character-set=utf8 ... [mysql] ... default-character-set=utf8 ... [mysqld] ... character-set-server = utf8 collation-server = utf8_general_ci character_set_server = utf8 collation_server = utf8_general_ci ...
测试
mysql -u root -p SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
参考文档:
If you have any questions, please contact me.