Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I simply want to open up mysql to be accessible from any server ip.

I have already commented out the bind-address in /etc/mysql/my.conf.

I have already setup the user account within mysql.

I have no clue whats stopping me from connecting.

The more challenging I see this being the more I realize how much of a security risk it is, and I get that, I just want to be able to do it temporarily.

I think that the iptables firewall is the last thing that is preventing me from achieving this, but sudo iptables -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT is seemingly doing nothing.

thomas@vannevar:~$ netstat -tl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 *:mysql                 *:*                     LISTEN     
tcp        0      0 *:git                   *:*                     LISTEN     
tcp        0      0 *:ssh                   *:*                     LISTEN     
tcp6       0      0 [::]:git                [::]:*                  LISTEN     
tcp6       0      0 [::]:http               [::]:*                  LISTEN     
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN     
tcp6       0      0 [::]:https              [::]:*                  LISTEN     

and

root@vannevar:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
fail2ban-ssh  tcp  --  anywhere             anywhere             multiport dports ssh
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             127.0.0.0/8          reject-with icmp-port-unreachable
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request
LOG        all  --  anywhere             anywhere             limit: avg 5/min burst 5 LOG level debug prefix "iptables denied: "
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

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

Chain fail2ban-ssh (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere     
share|improve this question
    
Did you try stopping firewall? you may have some rules that prevent you to connect from outside. Normally by commenting #bind-address will allow you bind mysql on any ip. –  Hex Jun 27 '12 at 23:37
add comment

2 Answers

up vote 0 down vote accepted

Did you comment out the bind-address or bind it to 0.0.0.0?

Also, try flushing your firewall completely. Dump them with an iptables-save > foo.fw and then execute an iptables -F to empty the rules list.

You can also see if it's bound correctly by doing a netstat -tl to see if mysql is listing to 3306 on "*"

share|improve this answer
    
I already flushed my iptables and got locked out of ssh my web server was pretty unresponsive overall (apache) so I couldn't see if mysql was working. Output from netstat -tl is in question. –  ThomasReggi Jun 28 '12 at 14:37
    
Just flushed and IT WORKED!!! serverfault.com/questions/129086/…. I'm putting up my current iptables -L could you tell me a more secure way to enable mysql then having no firewall? –  ThomasReggi Jun 28 '12 at 14:46
add comment

You need to enable it in mysql as well.

For example: USE mysql; SELECT * FROM user; UPDATE user set host ="%" WHERE host='127.0.0.1'; Hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.