首页 服务 产品 文档 关于

centos 华为OpenEuler 用c#连接MySQL出现错误 Unable to connect to any of the specified MySQL hosts.

centos 华为OpenEuler 用c#连接MySQL出现错误 Unable to connect to any of the specified MySQL hosts.

检查连接字符串没问题

防火墙也没开,

主要是因为iptables相关端口没开导致的

开放TCP3306端口***************************
1、开启iptables端口

开启1521端口:

iptables -A INPUT -p tcp --dport 3306 -j ACCEPT

iptables -A OUTPUT -p tcp --dport 3306 -j ACCEPT

2、保存iptables设置,重启iptables

在更改完设置后要先保存设置:

service iptables save

然后再重启iptables才能使设置生效:

service iptables restart

3、看端口

输入命令查看已开端口:

iptables -L -n