1. 程式人生 > 資料庫 >連線遠端伺服器上的MySQL

連線遠端伺服器上的MySQL

一、首先檢查伺服器提供商的安全組協議

二、開啟防火牆對應的埠

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;

五、在mysql圖形介面軟體中連線