Chinaunix

标题: 【讨论中】求助iptables开放Mysql的3306端口问题 [打印本页]

作者: CES4751    时间: 2010-07-26 17:47
标题: 【讨论中】求助iptables开放Mysql的3306端口问题
本帖最后由 cenalulu 于 2012-07-10 14:56 编辑

各位好,我自己的机器上跑着Mysql和Apache,iptables配成这样

Chain INPUT (policy DROP 75 packets, 5697 bytes)
pkts bytes   target    prot opt   in  out   source           destination
1742 126K   ACCEPT  tcp   --     *   *       0.0.0.0/0       0.0.0.0/0      tcp dpt:22
168   31861 ACCEPT  tcp   --     *   *       0.0.0.0/0       0.0.0.0/0      tcp dpt:80
1       60       ACCEPT  tcp   --     *   *       127.0.0.1/0   0.0.0.0/0      tcp dpt:3306

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source               destination         

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

这样配置以后本机的Apache就不能连接mysql了,请高手指点下原因,谢谢啦!
作者: 枫影谁用了    时间: 2010-07-26 18:03
1       60       ACCEPT  tcp   --     *   *       127.0.0.1/0   0.0.0.0/0      tcp dpt:3306

改成0.0.0.0/0.0.0.0

iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
作者: CES4751    时间: 2010-07-26 18:12
回复 2# 枫影谁用了

谢谢!不过之前试过了,没用。。。就算有用,也没法限制只能本机访问MySQL啊。。。
作者: 赵大少爷    时间: 2010-07-26 19:47
service iptables stop
作者: renxiao2003    时间: 2010-07-26 20:26
用图形配置界面吧。
作者: _06月_    时间: 2012-07-10 14:23
这个问题解决了吗,是不是把默认的input设置成drop了,所以不能用了,同一个子网下需要设置防火墙吗,只要设定外来的客户端不能访问mysql不就ok了吗
作者: aca_jingru    时间: 2012-07-10 15:38
你要限制mysql 只能本机访问的话,配置文件里只要加上 skip-networking 就可以了




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2