systemctl start mysqld
#查看数据库运行状态
systemctl status mysqld
查看并修改密码
cat /var/log/mysqld.log | grep password
#进入mysql
mysql -uroot -p
#执行修改密码sql
alter user 'root' @'localhost' identified withmysql_native_password by '自己的密码';
#退出,重新进入
exit
开启远程访问
#进入数据库执行
create user 'root'@'%' identified by '你的密码';
#授权
grant all privileges on *.* to'root'@'%';
#刷新权限
flush privileges;
#开放端口
firewall-cmd --zone=public--add-port=3306/tcp --permanent
#重载开放的端口
firewall-cmd --reload