安装/更新 MySQL:GPG key at file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql (0x5072E1F5) is already installed

环境:Rocky 9.1MySQL 8.0 / MySQL 5.7

目录

  • 1. 问题分析
  • 2. 解决方案
    • 2.1 直接导入新的 GPG key (推荐)
    • 2.2 跳过验证 (不推荐)
  • 3. 其他

1. 问题分析

# 报错日志如下:
Downloading Packages:
[SKIPPED] mysql-community-client-8.0.32-1.el8.x86_64.rpm: Already downloaded        
[SKIPPED] mysql-community-client-plugins-8.0.32-1.el8.x86_64.rpm: Already downloaded
[SKIPPED] mysql-community-common-8.0.32-1.el8.x86_64.rpm: Already downloaded        
[SKIPPED] mysql-community-icu-data-files-8.0.32-1.el8.x86_64.rpm: Already downloaded
[SKIPPED] mysql-community-libs-8.0.32-1.el8.x86_64.rpm: Already downloaded          
[SKIPPED] mysql-community-server-8.0.32-1.el8.x86_64.rpm: Already downloaded        
[SKIPPED] compat-openssl11-1.1.1k-4.el9_0.x86_64.rpm: Already downloaded            
MySQL 8.0 Community Server                            27 MB/s |  27 kB     00:00    

GPG key at file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql (0x5072E1F5) is already installed
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-client-8.0.32-1.el8.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Public key for mysql-community-client-plugins-8.0.32-1.el8.x86_64.rpm is not installed. Failing package is: mysql-community-client-plugins-8.0.32-1.el8.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Public key for mysql-community-common-8.0.32-1.el8.x86_64.rpm is not installed. Failing package is: mysql-community-common-8.0.32-1.el8.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Public key for mysql-community-icu-data-files-8.0.32-1.el8.x86_64.rpm is not installed. Failing package is: mysql-community-icu-data-files-8.0.32-1.el8.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Public key for mysql-community-libs-8.0.32-1.el8.x86_64.rpm is not installed. Failing package is: mysql-community-libs-8.0.32-1.el8.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Public key for mysql-community-server-8.0.32-1.el8.x86_64.rpm is not installed. Failing package is: mysql-community-server-8.0.32-1.el8.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'yum clean packages'.
Error: GPG check FAILED

》》错误日志中其实已经把错误信息描述的很清楚了,说白了就是验证 GPG 失败:

文件中的 GPG 密钥:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql (0x5072E1F5) 已安装
为“MySQL 8.0 Community Server”存储库列出的 GPG 密钥已经安装,但它们对于此包不正确。
检查是否为此存储库配置了正确的密钥 URL。失败的包是:mysql-community-client-8.0.32-1.el8.x86_64

2. 解决方案

2.1 直接导入新的 GPG key (推荐)

MySQL 的最新 GPG key 放在其官方的仓库地址中: https://repo.mysql.com

从更新日期中可以看到 MySQL 2022 年更换过一次,截止到 2023年3月17日,目前最新的还是 2022 年更新的。如果以后再遇到此类错误可以去官方仓库地址中看一下,有最新的就直接使用最新的。

# 如果出现上面的报错,需要导入最新的 GPG key 
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

安装/更新 MySQL:GPG key at file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql (0x5072E1F5) is already installed_第1张图片
执行导入成功后,就可以继续执行相应的安装命令:

yum install mysql-community-server

2.2 跳过验证 (不推荐)

yum install mysql-community-server -y --nogpgcheck

参数说明:
-y:安装中的待确认操作不必询问,默认 yes
--nogpgcheck:忽略 gpg 验证。

3. 其他

MySQL 这个还是好发现的,Docker Hub 上有的时候会直接升级镜像(image),都是泪呀。

踩坑记录: 项目中一直使用 Docker Hub 上的 tomcat:8 镜像,该镜像内使用的是 JDK 1.8;但是有次获取最新的时候,项目直接启动不起来,排查半天,结果是镜像内部的 JDK 变成了 11,用了快 2 年的镜像,谁也没想到会升级,哈哈。后续二次封装了基础镜像,然后上传到了私有仓库;官方镜像虽好,可不要贪杯哟,但是最好自己定制一下。

个人博客:Roc’s Blog

你可能感兴趣的:(数据库,#,MySQL,mysql,数据库,linux)