centos7下用yum安装mysql5.7报GPG Keys错误解决办法

系统:Centos7.9

先安装mysql5.7的yum源

rpm -Uvh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

安装mysql server

# yum install -y mysql-server

安装mysql server时报错

Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-libs-5.7.44-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-5.7.44-1.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

其实就是系统中mysql的GPG key过期了,更新一下。

删除现有的mysql相关密钥

rpm -e --allmatches gpg-pubkey$(rpm -qa | grep 'gpg-pubkey.*mysql' | sed 's/gpg-pubkey-//g')

导入最新的密钥

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

注意以下带2023年份,或不带年份的都不对
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql

清理yum缓存

yum clean all

安装mysql server

# yum install -y mysql-server

如果还有问题,欢迎点右边的QQ群,入群,免费解答与远程处理。

扩展阅读:————–

查看导入的密钥

rpm -qi gpg-pubkey$(rpm -qa | grep 'gpg-pubkey.*mysql' | cut -d- -f4)
声明:欢迎大家光临本站,学习IT运维技术,转载本站内容,请注明内容出处”来源刘国华教育“。如若本站内容侵犯了原著者的合法权益,请联系我们进行处理。