记录无法安装mysql-InvalidGPGKeyfromfile:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql的解决办法问题描述 在安装mysql时,可能会遇到以下错误: Error: Failed to download metadata for repo 'mysql56-community': Cannot prepare in
在安装mysql时,可能会遇到以下错误:
Error: Failed to download metadata for repo 'mysql56-community': Cannot prepare internal mirrorlist: Curl error (37): Couldn't read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql]
或者
warning: /var/cache/yum/x86_64/7/mysql-connectors-community/packages/mysql-connector-python-2.1.3-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
Package : mysql-community-release-el7-5.noarch (@/mysql-community-release-el7-5.noarch)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]:
这是由于系统缺少mysql官方的GPG秘钥文件所致。如果没有正确的密钥,yum 安装 MySQL 将失败。
自由互联热门推荐:PDF电子发票识别软件,一键识别电子发票并导入到Excel中!10大顶级数据挖掘软件!人工智能的十大作用! 解决办法 步骤一:下载官方密钥文件下载官方密钥文件,命令如下:
$ sudo wget https://repo.mysql.com/RPM-GPG-KEY-mysql
步骤二:移动官方密钥文件到/etc/pki/rpm-gpg/
将下载的官方密钥文件移动到 /etc/pki/rpm-gpg/
目录下,命令如下:
$ sudo mv RPM-GPG-KEY-mysql /etc/pki/rpm-gpg/
步骤三:安装 MySQL
安装 MySQL,指定 MySQL 版本,命令如下:
$ sudo yum install -y http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
$ sudo yum install -y mysql-community-server
示例说明
示例一
在 CentOS 7 上安装 MySQL,遇到以下报错:
warning: /var/cache/yum/x86_64/7/mysql-connectors-community/packages/mysql-connector-python-2.1.3-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
Package : mysql-community-release-el7-5.noarch (@/mysql-community-release-el7-5.noarch)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]:
按照以上步骤,下载 mysql 的官方 GPG 秘钥文件并且将其移动至 /etc/pki/rpm-gpg/
目录下,然后执行安装命令:
$ sudo yum install -y http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
$ sudo yum install -y mysql-community-server
示例二
在安装 mysql 时,遇到以下报错:
Error: Failed to download metadata for repo 'mysql56-community': Cannot prepare internal mirrorlist: Curl error (37): Couldn't read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql]
同样按照以上步骤,下载 mysql 的官方 GPG 秘钥文件并且将其移动至 /etc/pki/rpm-gpg/
目录下,然后执行安装命令:
$ sudo wget https://repo.mysql.com/RPM-GPG-KEY-mysql
$ sudo mv RPM-GPG-KEY-mysql /etc/pki/rpm-gpg/
$ sudo yum install -y http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
$ sudo yum install -y mysql-community-server