【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的版本都失败了,之前安装都是成功的,有明白相关信息的欢迎评论分享。

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值