CentOS7之 yum方式安装MySQL5.7
1. 下载并安装MySQL官方的 Yum Repository
[root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
2. 开始安装MySQL服务
[root@localhost ~]# yum -y install mysql-community-server
3.启动自启mysql服务
[root@localhost ~]# systemctl start mysqld.service
[root@localhost ~]# systemctl enable mysqld.service
4.获取系统产生的随机密码,并重置密码
[root@localhost ~]# grep "password" /var/log/mysqld.log
。。。。。。。。。。。。。。。。。。。。。随机密码
[root@localhost ~]# mysql -uroot –p‘随机密码’
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
5. 因安装了Yum Repository,以后每次yum操作都会自动更新,需要卸载掉mysql57-community-release-el7-10.noarch
[root@localhost ~]# yum -y remove mysql57-community-release-el7-10.noarch