Re: [GENERAL] Unable to connect to Postgresql

Поиск
Список
Период
Сортировка
От John Iliffe
Тема Re: [GENERAL] Unable to connect to Postgresql
Дата
Msg-id 201704091543.59685.john.iliffe@iliffe.ca
обсуждение исходный текст
Ответ на Re: [GENERAL] Unable to connect to Postgresql  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
On Sunday 09 April 2017 15:05:18 Adrian Klaver wrote:
> On 04/09/2017 11:33 AM, John Iliffe wrote:
> > On Saturday 08 April 2017 18:10:35 Joe Conway wrote:
> >> On 04/08/2017 01:23 PM, John Iliffe wrote:
> >>> On Saturday 08 April 2017 09:38:07 Adrian Klaver wrote:
> >>>> So what if you change the connection to use -h localhost?
> >>>
> >>> Can you please expand on that request?  I'm not sure where you want
> >>> me to put that directive.  I'm using the mod_php module in Apache.
> >>
> >> See the second example here:
> >>
> >> http://php.net/manual/en/function.pg-connect.php
> >>
> >> 8<-------------
> >> $dbconn2 = pg_connect("host=localhost port=5432 dbname=mary");
> >> // connect to a database named "mary" on "localhost" at port "5432"
> >> 8<-------------
> >>
> >> That will try to use a tcp connection on localhost instead of a unix
> >> socket.
> >
> > Thanks Joe.  I Changed the pg_connect line in the script to:
> >
> > --------------------------
> >
> >   $db_handle = pg_connect('dbname=yrarc host=192.168.1.6 port=5432
> >
> > user=xxxx password=xxxxxx');
> > ---------------------------
>
> So is this on the machine that has the Postgres server?

Yes, the machine has two addresses, 192.168.1.6 and 192.168.1.7

>
> If not change to that machine and use host=localhost, otherwise just
> change to host=localhost.
>
> > Even though "localhost" is in the /etc/hosts file the lookup failed to
>
> > resolve so I provided the full IP address.  The error from Apache is:
> Can you show us the /etc/host file?

----------------------------------------------
127.0.0.1   localhost localhost.localdomain localhost4
localhost4.localdomain4

::1         localhost localhost.localdomain localhost6
localhost6.localdomain6

192.168.1.1 default

----------------------------------------------
I added the blank lines above because the mail client had run them
together.  The real file doesn't have any blank lines in it between the host
definitions.

192.168.1.1 is the default Internet gateway.  This file was generated by the
Fedora installation programme.

John
========================================


В списке pgsql-general по дате отправления:

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: [GENERAL] Unable to connect to Postgresql
Следующее
От: John Iliffe
Дата:
Сообщение: Re: [GENERAL] Unable to connect to Postgresql