CentOS 7下MariaDB 5.5升级到MariaDB 10.2

升级主要步骤:

卸载mariadb ---》添加mariadb国内yum源 ---》安装mariadb---》初始化数据库。

1.     卸载mariadb

由于是在同一台服务器进行安装新的Mariadb10.2,所以我们需要将老的版本卸载。

卸载mariadb:

yum remove mariadb

删除配置文件:

rm -f /etc/my.cnf

删除数据目录:

rm -rf /var/lib/mysql/

 

2.    添加mariadb10.2的国内yum源

之前我添加的是国外的源,安装很耗时,所以我找到国内yum源,通过这个源安装较快。

vim  /etc/yum.repos.d/Mariadb.repo

添加以下内容:

[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

清除yum源缓存数据

yum clean all

生成新的yum源数据缓存

yum makecache all

官方yum源(国内安装较慢)

# MariaDB 10.2 CentOS repository list - created 2018-06-06 03:42 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

官方不同系统yum源网址:https://downloads.mariadb.org/mariadb/repositories/#mirror=tuna

 

3.   安装mariadb10.2

yum install -y mariadb mariadb-devel mariadb-server

启动并添加开机自启:

systemctl start mariadb.service
systemctl enable mariadb.service

 

4.   mariadb的初始化

/usr/bin/mysql_secure_installation

一般建议按以下进行配置:

Enter current password for root (enter for none): Just press the Enter button
Set root password? [Y/n]: Y
New password: your-MariaDB-root-password
Re-enter new password: your-MariaDB-root-password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: n
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y

以上就是整个版本升级的过程了。

 

你可能感兴趣的:(CentOS 7下MariaDB 5.5升级到MariaDB 10.2)