This enables the PostgreSQL database server to listen for incoming connection request and query request from any / all available IP address on the host machine. Save the changes by CTRL+X and YES. Above steps only enables networking related settings for remote access, next steps enables client authentication by making changes to the pghba.conf file.
I'm trying to setup a PostgreSQL database on an Ubuntu machine. I would like to be able to access it using pgAdmin3 from a remote machine. How do I setup this?
I have installed the PostgreSQL database on Ubuntu using:
In my
/etc/postgresql/9.1/main/pg_hba.conf
have I this line:so it should accept connections from all IPv4-addresses and passwords should be sent in clear text (this is for development reasons).
If I run this command to see what services is running:
I can see these lines, that is showing that PostgreSQL is accepting connections on the default port:
When I try to connect to this PostgreSQL server from a remote computer on the same local network I get this error message:
Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused Is the server running on host '10.0.1.7' and accepting TCP/IP connections on port 5432?
I used
postgres
as username and no password. But I have also tried with postgres
as password. On the local server I can login using:How can I connect to a PostgreSQL database running on Ubuntu from a remote machine using pgAdmin3?
JonasJonas
1 Answer
The line in your netstat report shows that the database is only listening on localhost:5432 (127.0.0.1) for incoming tcp connections.
So it can only accept local tcp connections regardless of what permissions you've specified in pg_hba.conf. pg_hba.conf only specifies allowed connections, but does not specify what interfaces your service will listen to.
The addresses the server listens on is specified with the listen_addresses GUC in postgresql.conf. If you want the server to listen for remote connections you should specify the ip(s) you want it to listen on or
*
to listen on all available interfaces on the host.To have your postgresql server listen on all interfaces on the host, you should have the following line in postgresql.conf:
dbenhurdbenhur
Not the answer you're looking for? Browse other questions tagged postgresqlubuntupgadmin or ask your own question.
I'm trying to setup a PostgreSQL database on an Ubuntu machine. I would like to be able to access it using pgAdmin3 from a remote machine. How do I setup this?
I have installed the PostgreSQL database on Ubuntu using:
In my
/etc/postgresql/9.1/main/pg_hba.conf
have I this line:so it should accept connections from all IPv4-addresses and passwords should be sent in clear text (this is for development reasons).
![Enable Enable](https://i.ytimg.com/vi/u6aMwpx5y1g/hqdefault.jpg)
If I run this command to see what services is running:
I can see these lines, that is showing that PostgreSQL is accepting connections on the default port:
When I try to connect to this PostgreSQL server from a remote computer on the same local network I get this error message:
Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused Is the server running on host '10.0.1.7' and accepting TCP/IP connections on port 5432?
I used
postgres
as username and no password. But I have also tried with postgres
as password. On the local server I can login using:How can I connect to a PostgreSQL database running on Ubuntu from a remote machine using pgAdmin3?
JonasJonas
1 Answer
The line in your netstat report shows that the database is only listening on localhost:5432 (127.0.0.1) for incoming tcp connections.
So it can only accept local tcp connections regardless of what permissions you've specified in pg_hba.conf. pg_hba.conf only specifies allowed connections, but does not specify what interfaces your service will listen to.
The addresses the server listens on is specified with the listen_addresses GUC in postgresql.conf. If you want the server to listen for remote connections you should specify the ip(s) you want it to listen on or
*
to listen on all available interfaces on the host.To have your postgresql server listen on all interfaces on the host, you should have the following line in postgresql.conf:
dbenhurdbenhur