1.由于centOS7.7中默认安装了MariaDB,需要先进行卸载
rpm -qa | grep -i mariadb
rpm -e --nodeps mariadb-libs-5.5.64-1.el7.x86_64
2.下载MySQL仓库并安装
wget https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm
yum install mysql80-community-release-el8-1.noarch.rpm
3.默认安装MySQL8.0,如果需要使用MySQL5.7的话需要修改/etc/yum.repos.d/mysql-community.repo配置文件
将mysql80中enabled属性改为0,并添加图中红框内代码
4.安装MySQL数据库
yum install mysql-community-server