一、首先检查服务器提供商的安全组协议
二、打开防火墙对应的端口
systemctl start firewalld
systemctl status firewalld
firewall-cmd --zone=public --add-port=3306/tcp --permanent
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;