'GPG keys issue while installing mysql-community-server

While Installing mysql-community-server getting bellow error:

Command:

 sudo yum install mysql-community-server

Error:

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

Can anyone help on this...



Solution 1:[1]

From: https://dev.mysql.com/doc/refman/8.0/en/checking-rpm-signature.html

There is no separate signature. RPM packages have a built-in GPG signature and MD5 checksum.

rpm also supports loading the key directly from a URL:

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

Solution 2:[2]

The GPG keys for the new release has been changed. See this for further info: https://support.cpanel.net/hc/en-us/articles/4419382481815?input_string=gpg+keys+problem+with+mysql+5.7

Steps to resovled this error the updated MySQL GPG will need to be installed.

  1. For existing systems, the MySQL repository file in /etc/yum.repos.d/ will need to have its 'gpgkey' line adjusted to:

    gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

Once adjusted, run the update once more:

/usr/local/cpanel/scripts/upcp
  1. For new installations you can import the key before running the installer:

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

Ubuntu:

wget -q -O https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 | apt-key add -

Solution 3:[3]

I had the same problem with two DNS-ONLY servers.

I edited the /etd/yum.repos.d/Mysql57.repo file and changed all the "gpgcheck=1" lines to "gpgcheck=0"

Then I executed yum update

Then I edited the /etd/yum.repos.d/Mysql57.repo file and changed all the "gpgcheck=0" lines back to "gpgcheck=1"

Finally, I updated the cPanel software.

Solution 4:[4]

This solved it for me on Debian 11:

wget --quiet --output-document - https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/mysql2022.gpg --import
chmod 644 /etc/apt/trusted.gpg.d/mysql2022.gpg

Before that apt-get update reported the key error, after that all good.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 huytmb
Solution 2 H Arif
Solution 3 ch saikiran
Solution 4 DHarrison74