centos7 安装mysql7

下载mysql的源

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

安装yum库

yum localinstall -y mysql57-community-release-el7-7.noarch.rpm

安装MySQL

yum install -y mysql-community-server

启动MySQL服务

systemctl start mysqld.service

查看默认密码

grep 'temporary password' /var/log/mysqld.log
结果如下:


image

登录

mysql -u root -p
输入密码登录

修改登录密码

如果修改的密码长度为6,则下面对应设置为6,本次设置密码为123456

 set global validate_password_policy=6;
 ALTER USER USER() IDENTIFIED BY '123456'

远程连接授权:

GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'your password' WITH GRANT OPTION;

开通端口(默认3306):

firewall-cmd --add-port=3306/tcp

参考:https://www.cnblogs.com/longrui/p/6071581.html

你可能感兴趣的:(centos7 安装mysql7)