1. 先下载MySQL Yum Repository
wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
2.Install the downloaded release package
sudo yum localinstall mysql80-community-release-el7-1.noarch.rpm;
3. 编辑mysql-community.repo, 将enable 5.7, disable 8.0
8.0默认是enabled,其它版本默认是disabled.(enabled=0为disabled,1为enabled,其它的不要修改)
vim /etc/yum.repos.d/mysql-community.repo
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
4. 查看当前enbled的版本是否正确:
yum repolist enabled | grep mysql
5. 安装mysql-community-client:
yum install mysql-community-client;
网友评论