Monday, July 14, 2014

Config postgresql to use pgAdmin from remote client

When I complete Odoo installation, I want to use pgAdminIII to connect to the database from a client computer, I encountered this error:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

To fix the issue, First:

sudo vi /etc/postgresql/9.1/main/postgresql.conf 

You need to add the following line in the config files, this change will not open your server to any computer though, you have opportunity to define which client(s) can access server later.

listen_addresses = '*'

Then: you will define which client(s) can access server here:

sudo vi /etc/postgresql/9.1/main/pg_hba.conf

Add the following line in the config files, in this case 192.168.0.40 is the client computer.

host   all             all             192.168.0.40/32          md5

Now you can use pgAdminIII from a client computer to access the database.

No comments:

Post a Comment