先更新yum源
#yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo#epel源
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repoyum clean allyum makecache
mysql的tar包下载路径:MySQL :: Download MySQL Community Server
下载前需要删除mariadb-libs,删除后安装即可
yum remove mariadb-libs-5.5.68-1.el7.x86_64 -y
yum install -y mysql-community-client-8.0.38-1.el7.x86_64.rpm mysql-community-common-8.0.38-1.el7.x86_64.rpm mysql-community-libs-8.0.38-1.el7.x86_64.rpm mysql-community-server-8.0.38-1.el7.x86_64.rpm mysql-community-icu-data-files-8.0.38-1.el7.x86_64.rpm mysql-community-client-plugins-8.0.38-1.el7.x86_64.rpm