1、启动mysql server
systemctl start mysqld #启动程序 systemctl enable mysqld #开机自运行 systemctl status mysqld #查看状态
2、查看初始密码
cat /var/log/mysqld.log|grep pass 或者 grep 'temporary password' /var/log/mysqld.log
3、本地登陆mysql
mysql -uroot -p
4、修改本地root用户密码
set global validate_password_policy=0; #密码强度设为最低等级 set global validate_password_length=4; #密码允许最小长度为4,也可以是1 ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; #修改密码
5、防火墙设置
(1)服务器的防火墙mysql端口3306是否开放 firewall-cmd --query-port=3306/tcp (2)设置3306端口为永久开放 firewall-cmd --add-port=3306/tcp --permanent (3)查看firewalld状态,发现当前是dead状态,即防火墙未开启 systemctl status firewalld (4)关闭防火墙 systemctl stop firewalld (5)重启防火墙(设置了新的端口记得重新防火墙) systemctl restart firewalld
标签:systemctl,log,mysql5.7,防火墙,命令,启停,mysqld,mysql,3306 From: https://www.cnblogs.com/sx66/p/16910487.html