1、登陸mysql
mysql -u root -p
2、設置訪問地址
如果你想允許用戶root從ip為192.168.1.123的主機連接到mysql服務器,並使用root作為密碼 GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.123'IDENTIFIED BY 'password' WITH GRANT OPTION;
3、刷新
flush privileges;
防火牆開啟
1、開啟端口3306
firewall-cmd --zone=public --add-port=3306/tcp --permanent
2、重啟防火牆
firewall-cmd --reload
查看已經開放的端口:
firewall-cmd --list-ports
