一、首先檢查服務器提供商的安全組協議
二、打開防火牆對應的端口
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;//刷新權限