centos mysql Error: GPG check FAILED

小豆苗 20天前 ⋅ 124 阅读

centos mysql Error: GPG check FAILED
报错解释:

在CentOS系统中安装MySQL时,如果遇到"Error: GPG check FAILED"错误,意味着你尝试安装的MySQL软件包的GPG签名验证失败。GPG(GNU Privacy Guard)是一种用于验证软件包完整性和来源的加密签名系统。这个错误通常发生在你从非官方源安装软件时,或者是因为你的系统缺少所需的GPG密钥。

解决方法:

确认你正在从官方MySQL Yum仓库安装。

导入MySQL的官方GPG密钥。可以通过运行以下命令:

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

如果你是从非官方源安装的,请确保你信任该源,并且它的GPG密钥已经被导入到你的系统中。

如果你已经导入了正确的GPG密钥,但仍然遇到这个错误,尝试清除缓存并重新导入密钥:

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

重新尝试安装MySQL。

确保在操作前备份好重要数据,避免因为GPG验证失败导致的数据损失。

 

安装Mysql 5.7

环境:

系统:centos8

软件:mysql 5.7

安装方式:yum安装

1、配置mysql 5.7的yum源

wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm

然后查看一下是否配置上:

yum repolist 查看已配置的yum源

[root@python01 ~]# yum repolist
repo id repo name
AppStream CentOS-8-stream - AppStream - mirrors.aliyun.com
base CentOS-8-stream - Base - mirrors.aliyun.com
extras CentOS-8-stream - Extras - mirrors.aliyun.com
mysql-connectors-community MySQL Connectors Community
mysql-tools-community MySQL Tools Community
mysql57-community MySQL 5.7 Community Server

2.1、yum安装mysql

yum -y install mysql-community-server
报错1:

Error: Unable to find a match: mysql-community-server
先关闭一下mysql模块,再继续执行yum install安装:

yum module disable mysql
报错2:

这是gpg验证不通过的原因,因为我是在centos8系统上安装mysql57-community-release-el7-10.noarch.rpm,即el7本身应该在centos7上安装的,但是5.7没有el8的包,如果安装mysql80-community-release-el8-4.noarch.rpm,就没有这个问题;

mysql 8.0 release下载地址:​ ​https://dev.mysql.com/downloads/repo/yum/​​

Error: GPG check FAILED
跳过gpg验证即可:

yum -y install mysql-community-server --nogpgcheck
报错3:GPG key到期

The GPG keys listed for the "MySQL 5.7 Community Server" repository are already installed but they are not correct for this package.
更新GPG key

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
2.2、启动mysql:

[root@python01 ~]# systemctl start mysqld.service
[root@python01 ~]# ps -ef|grep mysql
mysql 336231 1 17 13:30 ? 00:00:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

2.3、查看root默认密码并登录:

grep "password" /var/log/mysqld.log
mysql -uroot -p

2.4、修改密码:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';


全部评论: 0

    我有话说: