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.

Hi I have a Mysql db running on a ubunutu 10 server (hosted on Rackspace).

I'm trying to connect to this from a windows server that hosts my ASP.net website.

I've set up a Mysql User for the IP of the windows server

I've set my iptables to the following:

:OUTPUT ACCEPT [56:11468]
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT

If I specifiy the port 3306 in my connection string I get a SocketException telling me that the name is valid but no data of the requested type was found.

If I don't specify the port in my connection string I get a "No connection could be made because the target machine actively refused it ubuntu Ip: 3306"

I'm not really sure where to go with this but my gut instinct is that it is firewall related?

Any suggestions or advice would be greatfully received?

!!! As written in the comment to Maliq --- I hadn't changed the bind-address in mysql cnf to from I can't answer the question for another 8 hours as I haven't got enough server fault rep :(

share|improve this question
So is mysql actually LISTENING on the public IP? netstat -an | fgrep 3306 will reveal it. –  mailq Oct 18 '11 at 11:32
Hi Maliq, I've just figured it out. I'd not added the bind-address in mysql cnf. –  ActualAl Oct 18 '11 at 12:18
Thanks for your response too! –  ActualAl Oct 18 '11 at 12:19
Your firewall rules are not doing anything. You are just accepting all traffic. Is the mysql server really running and listening on the appropriate interface/port? –  Khaled Oct 18 '11 at 18:40

Your Answer


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

Browse other questions tagged or ask your own question.