ブラックボックス

プログラミングのノウハウやライフハックをどんどん投稿していきたい

Jan 23, 2022 - 1 minute read - ノウハウ

【MySQL】yum updateで鍵エラーが発生する

MySQLのリポジトリをyumに設定しMySQL8を使用していましたが、ある日yumでupdateしようとしたら下記のようなメッセージが出てアップデートできませんでした。

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.

環境:

  • OS:AmazonLinux2

一部省略しますが、実行時のログは下記のような感じ。

$ sudo yum update
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
49 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
:
:
Transaction Summary
================================================================================
Install              ( 2 Dependent packages)
Upgrade  41 Packages

Total size: 564 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/2/mysql80-community/packages/mysql-community-icu-data-files-8.0.28-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 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-icu-data-files-8.0.28-1.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

メッセージを読む限り、鍵ファイルが不一致とのこと。
どうやら鍵ファイルが更新されたとのことなので、更新後のファイルをインポートする。
ファイルのURLは下記。
https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

ということで、下記コマンドを実行。

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

上記実行後、再度yum updateを行い、アップデートが問題なく行われるようになったことを確認。