yum install -y mysql-server
mysql启动
systemctl start mysqld.service
systemctl enable mysqld.service
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload
登入mysql,没有密码回车就行
mysql -uroot -p //随机密码登录
设置root密码
use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root123456!';
退出重登
#退出
exit
#重登
mysql -uroot -p
设置远程访问
use mysql;
update user set host = '%' where user = 'root';
FLUSH PRIVILEGES;
再次登录,输入密码