阿里云CentOS7安装MySQL5.7成功2022年亲测
Posted 小基基o_O
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了阿里云CentOS7安装MySQL5.7成功2022年亲测相关的知识,希望对你有一定的参考价值。
前言
在虚拟机安装mysql5.7没问题,在阿里云装MySQL5.6也没问题
但是,2022年2月,新购的阿里云服务器装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.
经过一番摸索,发现是/etc/yum.repos.d/mysql-community.repo
中MySQL5.7的gpgcheck=1
GPG签名主用于Linux实现官方发布的包的签名机制,用于软件下载的安全
gpgcheck是GPG签名是否开启的选项:1
开启,0
不开启
完整安装步骤
- 更新 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
- 编辑
/etc/yum.repos.d/mysql-community.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成功2022年亲测的主要内容,如果未能解决你的问题,请参考以下文章