Connect to MySQL from remote domain

I’m trying (and failing) to connect to one of my DreamHost MySQL databases from a non-DreamHost domain using PHP.

Using the same PHP script, I CAN connect from my localhost server, from my DreamHost domain, but not from the non-Dreamhost remote domain.

I CAN connect from the non-Dreamhost domain using a shell account (via PuTTY) and the MySQL command line. I have added all the necessary IP addresses to the DreamHost MySQL whitelist, as indicated by the fact that I can connect via the MySQL command line interface from the non-DreamHost domain.

The error message I get when I run my PHP page from the non-DreamHost domain is:

Connect Error (2003) Can’t connect to MySQL server on ‘’ (110)

I know that I’m trying to connect to the correct DreamHost database because if I enter an incorrect database in my PHP script, the page returns an immediate error, while error above takes about 30 seconds to time out.

phpinfo() indicates that the non-DreamHost domain, which is running Apache, has both the mysql and mysqli libraries activate.

Anyone know how to get more detailed MySQL debug information or have any suggestions as to the reason for the failure?


MySQL error 110 is “connection timed out”. That almost sounds like the connection’s being blocked by a firewall somewhere – probably on the other domain’s end. Where are you trying to connect from?

I suspect you’re right about a firewall. I’m attempting to connect from a university’s Apache server. It’s interesting that I can connect via the MySQL command line interface from the unviversity’s server without problem, but then I’m connecting as myself, not from a php script. I was hoping there might be more granular debug info available but I guess not.

Is the university’s server running Red Hat or a related distribution? It’s possible that SELinux restrictions are tripping you up - the web server typically runs under a pretty limited context on those distributions.

It appears to be Red Hat. This is what phpinfo lists as the Configure Command:

--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' It’s to be expected that their server would be clamped down. I’ve seen comments about restrictions with SELinux and they sound pretty much like my situation.

Thanks for the useful observations. At this point I’m going to try to persuade the university to give me access to a MySQL database on one of their servers. There’s no telling how that will go; if they refuse I’ll probably come whining back here for more advice.

Thanks again for taking the time to respond