[已解决]Centos8 yum 安装mysql报错:Cannot download file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql: All mirrors were tried

Centos 8环境中用yum安装Mysql,执行到【yum install mysql-community-server -y 】时报错:

Cannot download file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql: All mirrors were tried

The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing ‘yum clean packages’.

解决方法:执行下面一行命令,再次用yum安装即可。

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

其中,RPM-GPG-KEY-mysql-2022需要替换成实际环境中遇到的报错信息,即预安装的版本。比如:

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

这个路径资源就是个文本key,示例:

参考资料:https://blog.csdn.net/sdutphp/article/details/125277467