ID #1051

What should I enter as 'hostname' when connecting to a MySQL server at an ISP.


It depends on the systems and the network settings at your ISP. The systems that ISP's operate are too numerous to mention. Some operate almost all their server programs on one very powerful (UNIX-) machine, others operate a network of many computers that are basically pc-type hardware. Some use Linux/Unix operating systems other Windows server systems (and some mix it!). And ISP's vary in size from 200 customers to 2.000.000. They can't all operate the same systems!

But the general answer is that probably the ISP operates some nameserver internally. Such nameserver will typically be configured with the some name like 'mysqlserver' pointing to the ip of the mysqlserver on the local network.

Direct connection:

If the ISP has the domain name then with direct connection you will use ''.

The information about the name assigned to the mysql server and thus the exact URL to the MySQL server usually is available as part of your account info from some web-based control panel application. Most likely it is something like '' or ''. If you can't find the information yourself you will have to ask the support/help desk there.

It also could happen that you could simply use '' or the global ip of the ISP, and traffic on port 3306 is routed to the MySQL server - but it won't always work - particularly not if it is a big ISP!. But everything here depends on the local routing systems used at the remote host - whether port-number based routing is active or not.


With HTTP-tunneling 'host' can simply be 'mysqlserver' (ie: 'mydb1' or 'mysql' or whatever). '' will work too, but there is no need for an extra domain lookup! If it is the same computer that runs the Web-server (with PHP-interpreter) and the MySQL server it can also be 'localhost' or the ip ''. PHP will connect to MySQL through a Unix-Socket if 'localhost' is specified and TCP if ''. Both will normally work. TCP may be a little bit slower on Linux machines than Socket, so you can try 'localhost' first. However there are situations where 'localhost' will return an error like error: 'Error No. 2013: Lost connection to MySQL server during query'. This is likely because PHP looks for the socket file where it does not exist. The underlying reason could be that MySQL and PHP have been installed from different repositories using different file positions for the socket file and the mysql datadir.


With SSH-tunneling there are two hosts' settings:

1) The 'MySQL Host Address' on the Server Tab on the connections manager: Here the 'host' is the 'path' to the MySQL-server relative to the SSH-server on the remote local network. Most often 'localhost' will do. If it does not work and 'mysqlserver' does not either you will have to ask the support/Sys Admin for more information. There are lots of possible ways to configure SSH on a network! Also here if the MySQL host as entered here cannot be reached from the SSH-server the MySQL client error: 'Error No. 2013: Lost connection to MySQL server during query' occurs. Thus this can be caused by an erroneous 'host' entry, but it can also be a network/configuration error on the remote network. Or the MySQL server simply could be down.

2) The 'SSH host' on the Tunnel Tab on the connections manager: This is the 'global URL' of the SHH server at the ISP. The ip will normally work fine, '' too. And maybe SSH is available via the internal name server too - then use something like ''.

Tags: -

Related entries:

You can comment this FAQ