centos7安装MySQL5.7

centos7安装MySQL5.7

下载MySQL的安装引导

1
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

安装MySQL安装引导

1
yum -y install mysql57-community-release-el7-10.noarch.rpm

安装MySQL服务

1
yum -y install mysql-community-server

启动MySQL服务

1
systemctl start  mysqld.service

检查MySQL状态

1
systemctl status mysqld.service

获取MySQL密码

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

使用刚获得到的初始密码进入MySQL

修改用户密码

1
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

允许用户远程访问

1
grant all privileges on *.* to 'root'@'%' identified by 'your password' with grant option;  #表示所有的主机都可以使用此账户登录,你也可以设定指定的IP地址

刷新权限

1
flush privileges; 

关闭防火墙

1
2
systemctl stop firewalld.service
systemctl status firewalld.service