- 切换 Mysql 镜像,加速下载
[root@centos ~]# wget http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm
[root@centos ~]# rpm -ivh mysql57-community-release-el7-7.noarch.rpm
- 检查有无以前下载过 Mysql
[root@localhost ~]# rpm -qa | grep mysql
如果显示不为空,就要把以前版本删除
rpm -e --nodeps 后面跟显示出来的以前版本的名称,如mysql-libs-5.1.73-5.e16_6.i686
- 下载 Mysql 安装包
rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
出现 Complete 即为安装成功。
如果安装过程中出现了:
warning: /var/cache/yum/x86_64/2.1903/mysql57-community/packages/mysql-community-libs-compat-5.7.38-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
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.
Failing package is: mysql-community-libs-compat-5.7.38-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
形如这样的内容,意为:安装的 Mysql Server 密钥不适用于这个版本,只需执行:
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
后重新安装即可,出现 Complete 即为安装成功。
后续的一些开机自启、本地workbench连接操作都看第二篇文章链接即可。
参考文章:
【阿里云镜像】切换阿里镜像,加速MySQL下载_xybDIY的博客-CSDN博客_mysql 阿里镜像