阿里云CentOS7安装MySQL5.7报错GPG校验不正确
Posted 小基基o_O
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了阿里云CentOS7安装MySQL5.7报错GPG校验不正确相关的知识,希望对你有一定的参考价值。
前言
2022年2月,在虚拟机安装mysql5.7没问题,在阿里云装MySQL5.6也没问题
但是,在阿里云服务器装MySQL5.7各种报错信息
执行yum -y install mysql-server
报错如下
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-server-5.7.37-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
然后执行systemctl start mysqld
报错如下
Failed to start mysqld.service: Unit not found.
大概意思是:
MySQL 5.7 Community Server
的仓库已装,但GPG校验不对
GPG签名主用于Linux实现官方发布的包的签名机制,用于软件下载的安全
执行yum
命令时,会遍历/etc/yum.repos.d/
下的repo文件
repo文件是 yum源 的配置文件
查看/etc/yum.repos.d/mysql-community.repo
中MySQL5.7内容:
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
配置 | 说明 | 备注 |
---|---|---|
baseurl | 下载地址 | 可改为国内镜像,更快 |
enabled | 是否批准 | 0 不批准,1 批准 |
gpgcheck | 是否校验GPG签名 | 0 不校验,1 校验 |
gpgkey | GPG校验的key | 在本地文件/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql |
对此,可修改gpgcheck
的值为0
,避免GPG校验
完整安装步骤
- 更新 YUM
yum -y update
- 下载MySQL的 RPM 文件
wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
- 安装MySQL的软件仓库
rpm -ivh mysql57-community-release-el7-11.noarch.rpm
- 编辑MySQL的repo文件,把
[mysql57-community]
下gpgcheck=1
改成gpgcheck=0
vim /etc/yum.repos.d/mysql-community.repo
- 安装MySQL服务
yum -y install mysql-server
- 启动MySQL服务
systemctl start mysqld
- 查看密码
cat /var/log/mysqld.log | grep password
- 使用上述密码登录
mysql -uroot -p
- 后面的操作:
https://yellow520.blog.csdn.net/article/details/113036158
以上是关于阿里云CentOS7安装MySQL5.7报错GPG校验不正确的主要内容,如果未能解决你的问题,请参考以下文章