前言
Linux安装mysql5.7
一、使用yum安装mysql5.7
1.卸载原有mysql
rpm查看安装
rpm -qa |grep mysql
mysql-community-libs-5.7.34-1.el7.x86_64
mysql80-community-release-el7-3.noarch
mysql-community-common-5.7.34-1.el7.x86_64
mysql-community-client-5.7.34-1.el7.x86_64
卸载
rpm -e mysql80-community-release-el7-3.noarch
rpm -e mysql-community-libs-5.7.34-1.el7.x86_64
rpm -e mysql-community-common-5.7.34-1.el7.x86_64
rpm -e mysql-community-client-5.7.34-1.el7.x86_64
清除余项
whereis mysql
删除安装文件
rm -rf /app/softwares/mysql
删除配置
rm –rf /etc/my.cnf
rm –rf /etc/init.d/mysql
rm -rf /root/.mysql_sercret
剩余配置检查
chkconfig --list | grep -i mysql
根据上面的列表,删除 ,如:mysqld
chkconfig --del mysqld
2.添加MySQL5.7仓库
sudo dnf remove @mysql
sudo dnf module reset mysql && sudo dnf module disable mysql
3.创建一个新的仓库文件
sudo vi /etc/yum.repos.d/mysql-community.repo
4.然后将以下内容粘贴到新建的仓库文件中
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
enabled=1
gpgcheck=0
[mysql-tools-community]
name