一、首先检查服务器提供商的安全组协议
二、打开防火墙对应的端口
systemctl start firewalld
systemctl status firewalld
firewall-cmd --zone=public --add-port=3306/tcp --permanent//开启3306端口
firewall-cmd --zone=public --add-port=3306/udp --permanent
三、在服务器上进入mysql
mysql -uroot -p //可以不显式写密码
四、在mysql命令行中输入
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;//赋予权限
flush privileges;//刷新权限