一.在线安装mysql
1.修改yum源 为阿里源
1.更改yum源为阿里。
首先备份 /etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3.运行以下命令生成缓存,完成安装
yum clean all
yum makecache
2.在线安装mysql
第一步:在线安装mysql相关的软件包
# 检查是否有mariadb并卸载
rpm -qa |grep mariadb |xargs yum remove -y
# 解决GPG验证不通过的问题
rpm --import https://repo.mysql.c