Google Cloud Centos 7 开启端口

今天折腾了下Google Cloud,用工具连接mysql始终失败,后来telnet下端口,发现端口是关闭的,于是去Google Cloud官网看了下,果不其然有防火墙。

1.登陆Google Cloud,切换到VPC网络——>防火墙规则—加入如下规则

防火墙规则配置

2.开放端口:

firewall-cmd --zone=public --add-port=3306/tcp --permanent

3.重载配置:

firewall-cmd --reload

4.mysql授权:

mysql>use mysql;
grant all privileges on *.* to 'root' @'%' identified by 'passwd';

5.刷新:

flush privileges;

6.登陆:

管理

猜你喜欢

转载自blog.csdn.net/c__chao/article/details/79785616