Mysql – phpMyAdmin works, but directly connecting with Sequel Pro does not

connectionmac-osxMySQL

I can connect to database with phpMyAdmin, but I cannot connect with Sequel Pro, using the same credentials. The host is mysql50-33.wc2.dfw1.stabletransit.com. When I connect using phpMyAdmin I notice it points to IP "172.17.70.16", but when I try mysql50-33.wc2.dfw1.stabletransit.com as host in Sequel Pro, I get this message:

Unable to connect to host
mysql50-33.wc2.dfw1.stabletransit.com,
or the request timed out.

Be sure that the address is correct
and that you have the necessary
privileges, or try increasing the
connection timeout (currently 10
seconds).

MySQL said: Lost connection to MySQL
server at 'reading initial
communication packet', system error:
61

And when I try 172.17.70.16, I get this message:

Unable to connect to host
172.17.70.16, or the request timed out.

Be sure that the address is correct
and that you have the necessary
privileges, or try increasing the
connection timeout (currently 10
seconds).

MySQL said: Can't connect to MySQL
server on '172.17.70.16' (4)

I am on Mac OS 10.6.7.

Best Answer

I am assuming you are using shared hosting.

Basics:

phpMyAdmin is running on the web server and connecting to MySQL either on the local machine or via an IP Address that is configured on the MySQL server to allow connections. In your case the IP is it connection to is a non-routable IP internal to your host (See RFC1918)

When you attempt to connect from your desktop you will be connecting directly to the MySQL server, and not through the web server.

The problem:

First,y ou do not have the correct IP address of the database server you are connecting to. The URL you provided may or may not actually resolve to the IP address of the database server. It may be the IP adress of a phpMyAdmin server, or your web server. There is no way to know without asking your host.

Second, the MySQL server is most likely not configured to allow direct connections from your machine's IP address OR the host's firewall is blocking you from connection to their network on that port.

Solution:

First, find out the correct public IP address of the MySQL server.

Second, if your host allows it, add your IP Address to the list of IPs allowed to connect to the database. If your host is cPanel based, which most shared hosts are, it should be very easy to add this. If your host does not allow this, then unfortunately, you will be out of luck and have no choice but to use phpMyAdmin.