Centos7 安装Mysql 5.7

一.下载并安装MySQL官方的 Yum Repository

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

二.安装

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

三.启动Mysql服务

systemctl start mysqld

四.修改mysql密码策略

vi /etc/my.cnf         #vi打开配置文件

#添加validate_password_policy配置
validate_password_policy=0
#关闭密码策略
validate_password = off

五.查看密码和修改密码

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

#登录mysql
mysql -uroot -p

#修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

六.开启远程访问

grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;             #%可以替换为对应的IP  %表示无限制
#立即生效
flush privileges; 
exit;    

 

posted @ 2020-03-11 15:10  hello-*-world  阅读(169)  评论(0编辑  收藏  举报