「CentOS 7」- 将「MariaDB 5.5」升级到「MariaDB 10.0」

  CREATED BY JENKINSBOT

#1 添加源

#!/bin/sh

cat <<EOF > /etc/yum.repos.d/MariaDB10.repo
# MariaDB 10.0 CentOS repository list – created 2014-10-13 13:04 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb-10.0]
name = MariaDB 10.0
baseurl = http://yum.mariadb.org/10.0/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

#2 数据备份

!!!备份原数据!!!
!!!备份原数据!!!
!!!备份原数据!!!

#3 停止并卸载旧服务

#!/bin/sh

# 停止服务
systemctl stop mariadb

# 删除旧的软件包
# (该步骤不会清除数据,不用担心)
yum remove mariadb-server mariadb mariadb-libs

# 清除仓库缓存
yum clean all

#4 安装并启动新服务

#!/bin/sh

yum -y install MariaDB-server MariaDB-client

systemctl start mysql

systemctl enable mysql

#5 升级数据库(关键步骤)

这一步骤是为了升级MySQL中的系统表:

#!/bin/sh

mysql_upgrade -h 127.0.0.1 -u root -p

#6 验证升级结果

#!/bin/sh

# 查看版本
mysql -V

参考文献

How to Upgrade MariaDB 5.5 to MariaDB 10.0 on CentOS 7