1. 删除现有包
rpm -qa |grep mariadb
结果:mariadb-libs-5.5.56-2.el7.x86_64
yum remove mariadb-libs-5.5.56-2.el7.x86_64
2. 增加yum repo
vim /etc/yum.repos.d/CentOS-MariaDB.repo, 增加如下内容
# MariaDB 10.2 CentOS repository list - created 2018-01-13 07:05 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
3. 安装
yum install MariaDB-server MariaDB-client
4. 配置
4.1 创建数据路径
mkdir -p /data/mariadb
chown -R mysql:mysql /data/mariadb
chmod -R 750 /data/mariadb
4.2 修改配置文件
4.2.1 /etc/my.cnf.d/mysql-clients.cnf
#
# These groups are read by MariaDB command-line tools
# Use it for options that affect only one utility
#
[client]
port = 3306
socket = /data/mariadb/mysql.sock
[mysql]
no-auto-rehash
[mysqldump]
quick
max_allowed_packet = 64M
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
4.2.2 /etc/my.cnf.d/server.cnf
[mysqld]
port = 3306
datadir = /data/mariadb
socket = /data/mariadb/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 64M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
thread_concurrency = 8
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
5. 关闭selinux
vim /etc/selinux/config
修改:SELINUX=disabled
重启系统
6. 启动
systemctl start mariadb
7. 修改密码
mysqladmin -u root password '123456'