centos7在线安装mysql5.7
钢翼
编程
卸载原来的mysql(若有)
rpm -qa | grep mysql
rpm -e {对应包名不包括版本号}
在https://repo.mysql.com/ 上找到要安装的rpm包
# 更新
yum update
# 下载rpm
wget https://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
# 安装rpm
rpm -ivh mysql57-community-release-el7-11.noarch.rpm
# 安装mysql
yum install mysql-community-server
如果报 The GPG keys listed for the "MySQL 5.7 Community Server" repository are already installed but they are not correct for this package. Check that the correct key URLs are configured for this repository.
# 解决MySQL GPG 密钥过期问题
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
# 重新安装mysql
yum install mysql-community-server
# 启动mysql服务
systemctl start mysqld
# 开机启动
systemctl enable mysqld