mysql错误代码2003

运维解决

Posted by 九块腹肌的徐先生 on 2020-12-07
Estimated Reading Time 1 Minutes
Words 273 In Total
Viewed Times

mysql链接异常

mysql01

今天上午,用户打电话来说数据库连不上了,页面没有了很着急。面对这种情况首先要想一下,自己有没有瞎比操作过,没有的话可以沉着冷静的恢复用户,稍等我看下。当然如果你做了,那就是另一个故事了。

mysql02

定位故障

要到用户名口令后自己连接一下发现,没有问题,我们的mysql通过nginx进行的代理,对外提供一个虚拟IP,实际对应这个两个真实地址。根据mysql的错误代码2003提示是连接问题,在确认账户密码网络环境都正常的情况下,定位应该是防火墙的问题。登录后端服务器发现其中一台服务器3306端口没有开放。

mysql03

执行以下代码实现防火墙端口的开放

1
2
3
firewall-cmd --add-port=3306/tcp --permanent                         #添加端口
firewall-cmd --reload #重启防火墙生效
firewall-cmd --list-ports #查看开通的端口

操作之后可以得到用户的好评


If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !