Re: Unable to connect to Postgresql

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: rob stone <floriparob(at)gmail(dot)com>, John Iliffe <john(dot)iliffe(at)iliffe(dot)ca>, pgsql-general(at)postgresql(dot)org
Cc: Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: Unable to connect to Postgresql
Date: 2017-04-10 00:07:01
Message-ID: ab51f957-1d0e-be06-5e5b-82232461802e@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/09/2017 03:27 PM, rob stone wrote:
> Hello John,
>
> Just saw this message.
>
>
>>
>> Still set to the default:
>>
>> #listen_addresses = 'localhost' # what IP address(es) to
>> listen on;
>> # comma-separated list of
>> addresses;
>> # defaults to 'localhost';
>> use '*'
>> for all
>> # (change requires restart)
>> #port = 5432 # (change requires restart)
>>
>> I did change the Unix domain socket directories:
>>
>> #unix_socket_directories = '/tmp' # comma-separated list of
>> directories
>> unix_socket_directories = '/tmp,/var/pgsql' # *****changed from
>> default
>> #
>>
>>
>
> Your set-up has Apache, PHP and Postgres all running from the same
> machine.
> So as far as running from there goes, it is "localhost".

The issue is not localhost, it is the case when John is trying to
connect without a host specifier and therefore is trying to reach the
Unix socket.

> There is no requirement to traverse a network. It is all on the same
> physical machine.
>
> Alter your postgresql.conf file and remove the hash so that:-
>
> listen_addresses = 'localhost'
>
> is explicitly defined. Alter pg_hba.conf so that localhost is declared
> and let's see what happens.

It will be the same effect, the commented line is just showing that the
default is 'localhost'. Though, John if you do decide to do this
remember to restart the server to have the change take effect.

>
> Cheers,
> Rob
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John Iliffe 2017-04-10 00:09:08 Re: Unable to connect to Postgresql
Previous Message Adrian Klaver 2017-04-10 00:01:32 Re: Unable to connect to Postgresql