根据官方文档使用yum安装MySQL5.7,添加mysl-comunity.repo如下:
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
执行安装
sudo yum install mysql-community-server
报错
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql"
原因及解决
yum仓库设置gpgcheck=1,下载安装时会去校验GPG key,本地找不到file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql就会报此错误。
解决方法:
- 禁用gpgcheck,设置gpgcheck=0即可
- 在指定的路径下添加GPG key文件