1)打开 mirrors.aliyun.com,选择centos的系统,点击帮助
2)执行命令:yum install wget -y
3)改变某些文件的名称
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
4)执行更换yum源的命令
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
5)更新本地缓存
yum clean all
yum makecache
yum list installed | grep mysql
yum -y remove mysql-libs.x86_64
yum install wget -y
wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install mysql-community-release-el6-5.noarch.rpm -y
原文件:
修改之后:
yum install mysql-community-server -y
#启动之前需要生成临时密码,需要用到证书,可能证书过期,需要进行更新操作
yum update -y
#启动mysql服务
service mysqld start
#设置mysql开机启动
chkconfig mysqld on
grep "password" /var/log/mysqld.log
mysql -uroot -p
#输入密码
set global validate_password_policy=0;
set global validate_password_length=1;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
#在[mysqld]部分添加:
character-set-server=utf8
#在文件末尾新增[client]段,并在[client]段添加:
default-character-set=utf8