设置阿里云的源
1 下载wget
yum install wget -y
2 echo 备份当前的yum源
mv /etc/yum.repos.d /etc/yum.repos.d.backup4comex
3 echo 新建空的yum源设置目录
mkdir /etc/yum.repos.d
4 echo 下载阿里云的yum源配置(根据系统版本,修改CentOS-后面的数值)
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
5 重建缓存
yum clean all
yum makecache
安装MySQL
1.下载mysql的repo源
# wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
#sudo rpm -ivh mysql-community-release-el7-11.noarch.rpm
安装这个包后,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo
3.安装mysql
# sudo yum install mysql-server