1.环境
操作系统:CentOS-7
2.检查是否安装过mysql
rpm -qa|grep -i mysql
不显示没安装过
3.卸载mysql
- yum remove -y mysql mysql-libs mysql-common
- rm -rf /var/lib/mysql
- rm /etc/my.cnf
- 删除mysql数据库,默认路径是:/var/lib/mysql
4.安装 mysql
#下载yum源
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
#安装yum源
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
# Yum 查看哪些子存储库已启用或禁用
yum repolist all | grep mysql
#开启mysql8的下载源
yum-config-manager --enable mysql80-community