Testing Database Connectivity

When troubleshooting a new environment, it is often helpful to isolate the various components in play and test them in isolation as simply as possible.

For testing connectivity to a database, a simple TCP connection can be made by using the telnet application. The advantage of using telnet is that is extremely simple. There are no configuration files to modify and no authentication. It either makes the connection or does not.

Once you know that the database is accessible, you can move on to testing via applications such as your database’s native client, or Looker.

Installing Telnet

Some hosts may come with Telnet pre-installed. To test this, try:

telnet ?

You should see something like this:

usage: telnet [-l user] [-a] [-s src_addr] host-name [port]

If you get a “command not found” error you will need to install telnet.

On Ubuntu:

sudo apt-get install telnet

On Redhat/CentOS:

yum install telnet

Default Ports

You will need to know which port your database is running on. The following table lists the default ports for a number of platforms, although your database may be configured to run on a different port. Consult your database administrator.

Platform Port
Amazon Redshift 5439
GreenPlum 5432
Microsoft SQL Server (MSSQL) 1433
MySQL 3306
Oracle 1521
PostgreSQL 5432
Vertica 5433

Connecting to Your Database with Telnet

To test the connection to your database, run telnet hostname port. For example, if you are running MySQL on the default port and your database name is mydb, the command would be telnet mydb 3306.

If the connection is working, you will see something similar to this:

Connected to mydb.
Escape character is '^]'.

If the connection is NOT working, you will see something like one of these:

telnet: Unable to connect to remote host: Connection timed out
telnet: Unable to connect to remote host: Connection refused
telnet: could not resolve mydb/telnet: Name or service not known


If the telnet check is not successful, consider the following:

Next Steps

If you are able to telnet your your database server’s port you can rule out basic connectivity issues. The next step is to create a Looker database connection.