User Tools

Site Tools


Preconditions for database connectivity

Firewall ports between client and database are open

  • PostgreSQL : TCP 5432
  • MySQL: 3306
  • MS-SQL: TCP 1433

You can test connections to these ports with telnet:

telnet <db_address> <db_port>

Network route to db server exists AND is persistent

On Red Hat

:?: See also network configuration

Persistent routes can be added on the interface configuration files under /etc/sysconfig/network-scripts/

Create a file named “route-eth2” for routes on interface eth2. The config will be read on interface boot up. via via

On Windows

Add a persitent route over the command line:

route add -p MASK

Database accepts connections from the client IP and from the db user

Check Database access from remote server


mysql -u <username> -p -h <db server ip>

Simple php test script:

# php script to test mysql connectivity
# credentials have to be changed...
# test connection
mysql_connect($host,$user,$password) or die("Unable to connect to database");
# test if database is accessible
@mysql_select_db($database) or die("Unable to select database");


psql -U <username> <databasename> -h <db server ip>


sqlcmd  -U <login id> -P <password> -S <server name> -d <db name>
/srv/ · Last modified: 2009/08/15 19:16 (external edit)