[caibo@localhost /]$ firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[caibo@localhost /]$ firewall-cmd --reloadmysql
systemctl stop firewalld.service #中止 systemctl disable firewalld.service #禁用
mysql安裝後還要容許遠程鏈接,其餘服務器才能鏈接到本地的數據庫。sql
mysql帳戶是否不容許遠程鏈接。若是沒法鏈接能夠嘗試如下方法:數據庫
mysql -u root -p //登陸MySQL
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; //任何遠程主機均可以訪問數據庫
mysql> FLUSH PRIVILEGES; //須要輸入次命令使修改生效
mysql> EXIT //退出服務器
也能夠經過修改表來實現遠程:tcp
mysql -u root -p.net
mysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> select host, user from user;blog
參考:http://blog.163.com/bo_cai@yeah/blog/static/86096191201541963521154/get