Thread: pgAdmin can't connect to port 5432

pgAdmin can't connect to port 5432

From
Michael J Martin
Date:
I realise this is probably my fault for not setting up Postgres properly 
so may question is how do you setup postgres to play nicely with pgAdmin?

Background:
We're with a host provider who uses FreeBSD and installed postgresql 
using their tools, it's running and I can get to it by using the 'psql' 
command at the SSH prompt. I can even use 'createdb' etc. as root or as 
the 'pgsql' user on the system.

I created a new user in postgres using: CREATE USER mike CREATEUSER 
PASSWORD 'whatevermypasswordis'.

But when I connect using pgAdmin3 (winxp) it says connection refused.

Ran a 'netstat' at the SSH prompt of the server and 5432 wasn't open but 
nor is 3306 and I can connect to the MySQL server on there running a 
front-end at my pc just fine.

'ps aux' says:
pgsql    49576  0.0  0.1 15136 2076  ??  Is    6:46PM   0:00.04 
/usr/local/bin/postmaster (postgres)
pgsql    49577  0.0  0.1  6868 2000  ??  I     6:46PM   0:00.01 
postmaster: stats buffer process    (postgres)
pgsql    49578  0.0  0.1  5940 2088  ??  I     6:46PM   0:00.01 
postmaster: stats collector process    (postgres)

'pg_ctl status' as root says:
pg_ctl: postmaster is running (PID: 49576)
Command line was:
/usr/local/bin/postmaster

'pg_ctl' as unprivileged user says:
pg_ctl: postmaster or postgres not running

I guess I'm just stuck and need help anyone know how to get pgAdmin to 
connect to postgresql? Is there anything I missed when setting it up?

Is there an IP wildcard I need to set somewhere, like the MySQL GRANT 
ALL ON *.* TO mike@'%' IDENTIFIED BY 'whatevermypasswordis';?

Thanks,

Michael


Re: pgAdmin can't connect to port 5432

From
Michael J Martin
Date:
Just to mention the error I get is not a 'process isn't running' error 
it is:

Error connecting to the server: FATAL:  no pg_hba.conf entry for host 
"212.159.49.21", user "mike", database "template1", SSL off

Hope this helps.

Michael

Michael J Martin wrote:

> I realise this is probably my fault for not setting up Postgres 
> properly so may question is how do you setup postgres to play nicely 
> with pgAdmin?
>
> Background:
> We're with a host provider who uses FreeBSD and installed postgresql 
> using their tools, it's running and I can get to it by using the 
> 'psql' command at the SSH prompt. I can even use 'createdb' etc. as 
> root or as the 'pgsql' user on the system.
>
> I created a new user in postgres using: CREATE USER mike CREATEUSER 
> PASSWORD 'whatevermypasswordis'.
>
> But when I connect using pgAdmin3 (winxp) it says connection refused.
>
> Ran a 'netstat' at the SSH prompt of the server and 5432 wasn't open 
> but nor is 3306 and I can connect to the MySQL server on there running 
> a front-end at my pc just fine.
>
> 'ps aux' says:
> pgsql    49576  0.0  0.1 15136 2076  ??  Is    6:46PM   0:00.04 
> /usr/local/bin/postmaster (postgres)
> pgsql    49577  0.0  0.1  6868 2000  ??  I     6:46PM   0:00.01 
> postmaster: stats buffer process    (postgres)
> pgsql    49578  0.0  0.1  5940 2088  ??  I     6:46PM   0:00.01 
> postmaster: stats collector process    (postgres)
>
> 'pg_ctl status' as root says:
> pg_ctl: postmaster is running (PID: 49576)
> Command line was:
> /usr/local/bin/postmaster
>
> 'pg_ctl' as unprivileged user says:
> pg_ctl: postmaster or postgres not running
>
> I guess I'm just stuck and need help anyone know how to get pgAdmin to 
> connect to postgresql? Is there anything I missed when setting it up?
>
> Is there an IP wildcard I need to set somewhere, like the MySQL GRANT 
> ALL ON *.* TO mike@'%' IDENTIFIED BY 'whatevermypasswordis';?
>
> Thanks,
>
> Michael
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings




Re: pgAdmin can't connect to port 5432

From
Andreas Pflug
Date:
Michael J Martin wrote:
> Just to mention the error I get is not a 'process isn't running' error 
> it is:
> 
> Error connecting to the server: FATAL:  no pg_hba.conf entry for host 
> "212.159.49.21", user "mike", database "template1", SSL off
> 

As the message tells, you need to edit pg_hba.conf to allow the connection.

Regards,
Andreas


Re: pgAdmin can't connect to port 5432

From
Justin Clift
Date:
Hi Michael,

In the PostgreSQL data directory on the server, there is a file called 
"pg_hba.conf".  (It stands for PostgreSQL "Host Based Access" 
configuration I think)

This file contains the list of IP addresses plus user names and 
databases that people are allowed to connect to remotely.  The error 
you're getting indicates that you've connected to the database server, 
but it's not letting you actually "get in" because your IP address, user 
name (and so on) isn't listed in this configuration file.

You'll need to add your details there, then tell the PostgreSQL server 
to reload this configuration file:

$ pg_ctl reload

The configuration file itself is quite a lot of verbose text, describing 
how to add entries in there.  Generally you can just copy an existing 
entry and change it appropriately.

Hope that helps.

Regards and best wishes,

Justin Clift


Michael J Martin wrote:
> Just to mention the error I get is not a 'process isn't running' error 
> it is:
> 
> Error connecting to the server: FATAL:  no pg_hba.conf entry for host 
> "212.159.49.21", user "mike", database "template1", SSL off
> 
> Hope this helps.
> 
> Michael