在Linux系统安装MySQL的时候,想要移除系统自带的mysql版本,使用 yum -y remove mysql-libs.x86_64
命令进行移除时报以下错误:
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
http://mirror.centos.org/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
出现这个错误的原因是 yum 源失效了,需要更换新的源地址。具体方法如下:
-
su root 切换到超级用户
-
在根目录下执行命令
vi /etc/yum.repos.d/CentOS-Base.repo
,把这个文件里面的内容全部注释或者直接替换为以下内容:[base] name=CentOS-6 failovermethod=priority baseurl=https://vault.centos.org/6.9/os/x86_64/ gpgcheck=0
-
保存退出,重试删除操作
这个问题对于初学者确实挺麻烦,没定位准错误原因就很难解决。我也在网上找了好多方法都不管用,像什么把 baseurl 取消注释,把 $releasever替换成为Cnet OS 的版本等等,最终还是在同学的帮助下,大致确定就是 yum 源失效的问题(好像好多CentOS6的源都失效了),然后就找到一篇比较新的博客记录 Cent OS 6 yum源失效 404 ,参考其方法成功解决。