dnf install mysql-server报错:Error: GPG check FAILED

Amazon Linux 2023(AL2023)系统下安装mysql-server 8 的时候遭遇下面的错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 安装 EL9 mysql80-community 软件存储库
~]# dnf -y localinstall https://dev.mysql.com/get/mysql80-community-release-el9-1.noarch.rpm
...
Installed:
mysql80-community-release-el9-1.noarch

Complete!
~]# dnf install -y mysql-server mysql
MySQL 8.0 Community Server
...
Key imported successfully
Import of key(s) didn't help, wrong key(s)?
Public key for mysql-community-client-8.0.37-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-client-8.0.37-1.el9.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Public key for mysql-community-client-plugins-8.0.37-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-client-plugins-8.0.37-1.el9.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Public key for mysql-community-common-8.0.37-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-common-8.0.37-1.el9.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Public key for mysql-community-icu-data-files-8.0.37-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-icu-data-files-8.0.37-1.el9.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Public key for mysql-community-libs-8.0.37-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-libs-8.0.37-1.el9.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Public key for mysql-community-server-8.0.37-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-server-8.0.37-1.el9.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: GPG check FAILED

用以下命令导入2023年最新的Key即可解决问题。

1
~]# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023