mysqlamazon-ec2

I'm using amazon linux and trying to install mysql in ec2, but I keep getting the error "GPG key a is already installed" It happens


I am currently trying to install mysql in ec2, but the "GPG key" error keeps occurring.

- errormessage

[root ec2-user]# sudo yum install mysql-community-server
Last metadata expiration check: 3:41:39 ago on Thu Jan 25 23:25:24 2024.
Dependencies resolved.
===================================================================================================
 Package                             Arch        Version              Repository              Size
===================================================================================================
Installing:
 mysql-community-server              x86_64      8.0.36-1.el9         mysql80-community       49 M
Installing dependencies:
 mysql-community-client              x86_64      8.0.36-1.el9         mysql80-community      3.4 M
 mysql-community-client-plugins      x86_64      8.0.36-1.el9         mysql80-community      1.4 M
 mysql-community-common              x86_64      8.0.36-1.el9         mysql80-community      556 k
 mysql-community-icu-data-files      x86_64      8.0.36-1.el9         mysql80-community      2.3 M
 mysql-community-libs                x86_64      8.0.36-1.el9         mysql80-community      1.4 M

Transaction Summary
===================================================================================================
Install  6 Packages

Total size: 58 M
Installed size: 334 M
Is this ok [y/N]: y
Downloading Packages:
[SKIPPED] mysql-community-client-8.0.36-1.el9.x86_64.rpm: Already downloaded                      
[SKIPPED] mysql-community-client-plugins-8.0.36-1.el9.x86_64.rpm: Already downloaded              
[SKIPPED] mysql-community-common-8.0.36-1.el9.x86_64.rpm: Already downloaded                      
[SKIPPED] mysql-community-icu-data-files-8.0.36-1.el9.x86_64.rpm: Already downloaded              
[SKIPPED] mysql-community-libs-8.0.36-1.el9.x86_64.rpm: Already downloaded                        
[SKIPPED] mysql-community-server-8.0.36-1.el9.x86_64.rpm: Already downloaded                      
MySQL 8.0 Community Server                                         3.0 MB/s | 3.1 kB     00:00    
GPG key at file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022 (0x3A79BD29) 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.36-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.36-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-client-plugins-8.0.36-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.36-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-common-8.0.36-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.36-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-icu-data-files-8.0.36-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.36-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-libs-8.0.36-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.36-1.el9.x86_64.rpm is not installed. Failing package is: mysql-community-server-8.0.36-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 'yum clean packages'.
Error: GPG check FAILED

In another Stack Overflow article:

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

I saw a post asking me to enter this command.

So even if I enter this and install again,

sudo yum install mysql-community-server

but the same error continues to occur.

What part is the problem?

Please help me..

- my os

[root@ ec2-user]# cat /etc/os-release
NAME="Amazon Linux"
VERSION="2023"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2023"
PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023"
HOME_URL="https://aws.amazon.com/linux/"
BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023"
SUPPORT_END="2028-03-15"

Solution

  • Now an actual answer.

    Run:

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

    Notice the "2023"

    Apparently they updated the GPG keys... Never found any reference to this, just tried out the command and it worked.