安装wget软件

yum-yinstallwget

下载MySQL的RPM文件

wgethttps://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

安装MySQL的RPM文件

rpm-ivhmysql57-community-release-el7-11.noarch.rpm

安装MySQL软件

yum-yinstallmysql-server

启动MySQL软件

servicemysqldstart

systemctlstartmysqld.service

查询MySQL状态

servicemysqldstatus

systemctlstatusmysqld.service

查看密码

grep'temporarypassword'/var/log/mysqld.log

登录

mysql-uroot-p

修改密码

setglobalvalidate_password_policy=0;

setglobalvalidate_password_length=1;

ALTERUSER'root'@'localhost'IDENTIFIEDBY'liunancun';

开启远程访问权限

GRANTALLPRIVILEGESON*.*TO'root'@'%'IDENTIFIEDBY'liunancun'WITHGRANTOPTION;

flushprivileges;

或者

usemysql;

updateusersethost='%'whereuser='root';

selecthost,userfromuser;

查看防火墙状态

firewall-cmd--state

停用防火墙

systemctlstopfirewalld.service

禁止防火墙开启启动

systemctldisablefirewalld.service