免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4166 | 回复: 3
打印 上一主题 下一主题

求助,MYSQL连接本机IP,IPTABLE如何设置? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-25 23:40 |只看该作者 |倒序浏览
如题,我在使用Discuz论坛的时候,MYSQL数据库连接地址必须使用本身IP地址,不能使用localhost,数据库与WEB放在同一台服务器上,IPTABLES规则如下
[root@IP215 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:mysql
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:rtsp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:mice
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:zenginkyo-2
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ftp
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,SYN,RST,PSH,ACK,URG
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,PSH,URG
DROP       tcp  --  anywhere             anywhere            tcp flags:SYN,RST/SYN,RST
DROP       all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/SYN

求助如何来设置IPTABLES?

论坛徽章:
0
2 [报告]
发表于 2008-12-27 22:54 |只看该作者
在output里加一条允许3306端口(默认mysql端口)的规则

论坛徽章:
0
3 [报告]
发表于 2008-12-29 11:36 |只看该作者
把策略更改为这样就行了.

[root@IP215 ~]# iptables -vnL
Chain INPUT (policy DROP 115 packets, 7991 bytes)
pkts bytes target     prot opt in     out     source               destination
1519  512K ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
3718  403K ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 22,80,554,3306,5020,5021,5022
   62  7656 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
  347 28683 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source               destination
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain OUTPUT (policy ACCEPT 9358 packets, 4893K bytes)
pkts bytes target     prot opt in     out     source               destination

论坛徽章:
0
4 [报告]
发表于 2009-01-21 09:59 |只看该作者
MySQL使用的是3306端口。
既然数据库和网站都放在同一个服务器上,还用写规则吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP