97-install_rpm

0. 更换yum源

# 1. 打开mirrors.aliyun.com,选择centos的系统,点击帮助

# 2. install wget
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

1. 是否已安装

yum list installed | grep mysql
1570541665646

2. 删除已安装

yum -y remove mysql-libs.x86_64

3. 安装wget

yum install wget -y

4. 添加rpm源

  • rpm(redhat package manager)Red Hat Linux发行版专门用来管理Linux各项套件的程序
wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

5. 安装rpm文件

yum install mysql-community-release-el6-5.noarch.rpm -y

6. yum.repos.d

  • /etc/yum.repos.d/文件夹下增加两个文件
1570542341604

7. 修改mysql-community.repo

  • 原文件:
1570542415955
  • 修改之后:
1570542471948

8. yum安装mysql

yum install mysql-community-server -y

9. 设置开机启动

# 启动之前需要生成临时密码,需要用到证书,可能证书过期,需要进行更新操作
yum update -y
# 启动mysql服务
service mysqld start
# 设置mysql开机启动
chkconfig mysqld on

10. 获取mysql的临时密码

grep "password" /var/log/mysqld.log
1570604493708

11. 使用临时密码登录

mysql -uroot -p
# 输入密码

12. 修改密码

set global validate_password_policy=0;
set global validate_password_length=1;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

13. 修改远程访问权限

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;

14. 设置字符集为utf-8

# 在[mysqld]部分添加:
character-set-server=utf8
# 在文件末尾新增[client]段,并在[client]段添加
default-character-set=utf8