mysql日常Mysql客户端安装失败-GPG验证不通过

Posted 张国荣家的弟弟

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql日常Mysql客户端安装失败-GPG验证不通过相关的知识,希望对你有一定的参考价值。

文章目录

报错原文

当我输入命令:yum install mysql

[root@qbi-executor-01 mysql]# yum install mysql
Loaded plugins: fastestmirror, langpacks, releasever-adapter, update-motd
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.38-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.38-1.el7.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.1.al7 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.1.al7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.1.al7.x86_64
---> Package mysql-community-libs.x86_64 0:5.7.38-1.el7 will be obsoleting
--> Processing Dependency: mysql-community-common(x86-64) >= 5.7.9 for package: mysql-community-libs-5.7.38-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-common.x86_64 0:5.7.38-1.el7 will be installed
---> Package mysql-community-libs-compat.x86_64 0:5.7.38-1.el7 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                      Arch    Version          Repository          Size
================================================================================
Installing:
 mysql-community-client       x86_64  5.7.38-1.el7     mysql57-community   28 M
 mysql-community-libs         x86_64  5.7.38-1.el7     mysql57-community  2.6 M
     replacing  mariadb-libs.x86_64 1:5.5.68-1.1.al7
 mysql-community-libs-compat  x86_64  5.7.38-1.el7     mysql57-community  1.2 M
     replacing  mariadb-libs.x86_64 1:5.5.68-1.1.al7
Installing for dependencies:
 mysql-community-common       x86_64  5.7.38-1.el7     mysql57-community  311 k

Transaction Summary
================================================================================
Install  3 Packages (+1 Dependent package)

Total size: 32 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/2.1903/mysql57-community/packages/mysql-community-client-5.7.38-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-client-5.7.38-1.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

直译过来:

为“MySQL 5.7 社区服务器”存储库列出的 GPG 密钥已安装,但它们对于此软件包不正确。检查是否为此存储库配置了正确的密钥 URL。

可以理解为:CentOS7.6 安装mysql5.7的时候报错,提示某一个包安装不成功。

操作系统:CentOS 7.5
Mysql版本:mysql5.7

总结失败原因:
GPG对于包的源key的验证没有通过

解决办法

在yum install 版本后面加上 --nogpgcheck,即可绕过GPG验证成功安装。比如命令:yum install mysql-community-server --nogpgcheck

[root@qbi-executor-01 mysql]# yum install mysql-community-server --nogpgcheck
Loaded plugins: fastestmirror, langpacks, releasever-adapter, update-motd
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.38-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.38-1.el7 for package: mysql-community-server-5.7.38-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.38-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.38-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.38-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.38-1.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.1.al7 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.1.al7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.1.al7.x86_64
---> Package mysql-community-libs.x86_64 0:5.7.38-1.el7 will be obsoleting
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.38-1.el7 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                      Arch    Version          Repository          Size
================================================================================
Installing:
 mysql-community-libs         x86_64  5.7.38-1.el7     mysql57-community  2.6 M
     replacing  mariadb-libs.x86_64 1:5.5.68-1.1.al7
 mysql-community-libs-compat  x86_64  5.7.38-1.el7     mysql57-community  1.2 M
     replacing  mariadb-libs.x86_64 1:5.5.68-1.1.al7
 mysql-community-server       x86_64  5.7.38-1.el7     mysql57-community  178 M
Installing for dependencies:
 mysql-community-client       x86_64  5.7.38-1.el7     mysql57-community   28 M
 mysql-community-common       x86_64  5.7.38-1.el7     mysql57-community  311 k

Transaction Summary
================================================================================
Install  3 Packages (+2 Dependent packages)

Total size: 209 M
Total download size: 178 M
Is this ok [y/d/N]: y
Downloading packages:
mysql-community-server-5.7.38-1.el7.x86_64.rpm             | 178 MB   00:16
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql-community-common-5.7.38-1.el7.x86_64                   1/6
  Installing : mysql-community-libs-5.7.38-1.el7.x86_64                     2/6
  Installing : mysql-community-client-5.7.38-1.el7.x86_64                   3/6
  Installing : mysql-community-server-5.7.38-1.el7.x86_64                   4/6
  Installing : mysql-community-libs-compat-5.7.38-1.el7.x86_64              5/6
  Erasing    : 1:mariadb-libs-5.5.68-1.1.al7.x86_64                         6/6
  Verifying  : mysql-community-libs-compat-5.7.38-1.el7.x86_64              1/6
  Verifying  : mysql-community-client-5.7.38-1.el7.x86_64                   2/6
  Verifying  : mysql-community-server-5.7.38-1.el7.x86_64                   3/6
  Verifying  : mysql-community-common-5.7.38-1.el7.x86_64                   4/6
  Verifying  : mysql-community-libs-5.7.38-1.el7.x86_64                     5/6
  Verifying  : 1:mariadb-libs-5.5.68-1.1.al7.x86_64                         6/6

Installed:
  mysql-community-libs.x86_64 0:5.7.38-1.el7
  mysql-community-libs-compat.x86_64 0:5.7.38-1.el7
  mysql-community-server.x86_64 0:5.7.38-1.el7

Dependency Installed:
  mysql-community-client.x86_64 0:5.7.38-1.el7
  mysql-community-common.x86_64 0:5.7.38-1.el7

Replaced:
  mariadb-libs.x86_64 1:5.5.68-1.1.al7

Complete!

看到上面的complet完成就神奇的成功了!

疑问

但是不明白包的源key为什么没有通过验证?这里很奇怪,我尝试了好几个5.7的版本都失败了,之前安装都是成功的,有明白相关信息的欢迎评论分享。

以上是关于mysql日常Mysql客户端安装失败-GPG验证不通过的主要内容,如果未能解决你的问题,请参考以下文章

centos 7安装mysql

已解决:源 “MySQL 5.7 Community Server“ 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确 和 报错:`ERROR 1045 (28000

mysql日常Centos安装Mysql客户端

阿里云CentOS7安装MySQL5.7报错GPG校验不正确

PHP,MySQL返回“连接失败:服务器请求客户端未知的身份验证方法” [重复]

安装MySQL 出现initializing database安装失败解决办法