首先进入目录
cd /etc/yum.repos.d/
修改yum的原地址
vi CentOS-Base.repo
修改"baseurl="后连接, http://vault.centos.org/5.8/os/x86_64/
修改“gpgkey=”后连接, http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5
注释掉#
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
如下所示修改的文件格式:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://vault.centos.org/5.8/os/x86_64/
gpgcheck=1
gpgkey=http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://vault.centos.org/5.8/os/x86_64/
gpgcheck=1
gpgkey=http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://vault.centos.org/5.8/os/x86_64/
gpgcheck=1
gpgkey=http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://vault.centos.org/5.8/os/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://vault.centos.org/5.8/os/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5
保存文档
:wq
运行 yum clean all
运行 yum makecache
这样就应该成功了
就可以安装mysql了
yum install -y mysql mysql-server mysql-devel