在centos7中安装mysql时出现的问题:The GPG keys listed for the "MySQL 8.0 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.
Check that the correct key URLs are configured for this repository.
Failing package is: mysql-community-libs-8.0.39-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql)
1. 出现错误的操作步骤
1.添加 MySQL Yum Repository MySQL 社区版默认没有包含在 CentOS 的标准包中,所以需要先添加 MySQL 的官方仓库:
sudo yum install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
出现command not found字样,是你的虚拟机没安装yum,自己去安装一下,就一个命令
2.安装 MySQL 添加仓库后,可以使用 yum 安装 MySQL:
sudo yum install mysql-server
这个时候出现了错误:
The GPG keys listed for the "MySQL 8.0 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-8.0.39-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
意思就是说MySQL 8.0 Community Server,这个8.0与GPG Keys不匹配
那就好办,直接换一个版本不就好了
2 解决办法
输入命令
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
这篇文章时2024年写的,我感觉规律就是晚一年的这个版本就好了
再把上面的命令执行一遍就好了