Thread: problem accessing a database

problem accessing a database

From
Luca Ferrari
Date:
Hi all,
I've got a database on a server that can be accessed thru the user wwwrun with
no password. Now I'd like to copy it on my laptop, so I created the wwwrun
(with no password) and thru pg_dump and pg_restore I copied the database on
the laptop. The problem is that on the latter I'm unable to log as wwwrun, I
got:
[luca@fluca:~]$ psql -U wwwrun
psql: FATAL:  Ident authentication failed for user "wwwrun"

What should I change on my laptop to get the database working?

Thanks,
Luca

Re: problem accessing a database

From
"A. Kretschmer"
Date:
am  Fri, dem 03.11.2006, um 15:36:04 +0100 mailte Luca Ferrari folgendes:
> Hi all,
> I've got a database on a server that can be accessed thru the user wwwrun with
> no password. Now I'd like to copy it on my laptop, so I created the wwwrun
> (with no password) and thru pg_dump and pg_restore I copied the database on
> the laptop. The problem is that on the latter I'm unable to log as wwwrun, I
> got:
> [luca@fluca:~]$ psql -U wwwrun
> psql: FATAL:  Ident authentication failed for user "wwwrun"
>
> What should I change on my laptop to get the database working?

The settings in your pg_hba.conf.
This file contains comments, read this to understand the proper content.
I guess, you want change the method to trust.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: problem accessing a database

From
Luca Ferrari
Date:
On Friday 03 November 2006 15:44 A. Kretschmer's cat, walking on the keyboard,
wrote:
> The settings in your pg_hba.conf.
> This file contains comments, read this to understand the proper content.
> I guess, you want change the method to trust.


But I've already configured pg_hba.conf (maybe in a wrong way):
host    all         all         127.0.0.1/32          trust

that should allows me (localhost) to access the database. Isn't right?

Luca

Re: problem accessing a database

From
"A. Kretschmer"
Date:
am  Fri, dem 03.11.2006, um 15:58:51 +0100 mailte Luca Ferrari folgendes:
> On Friday 03 November 2006 15:44 A. Kretschmer's cat, walking on the keyboard,
> wrote:
> > The settings in your pg_hba.conf.
> > This file contains comments, read this to understand the proper content.
> > I guess, you want change the method to trust.
>
>
> But I've already configured pg_hba.conf (maybe in a wrong way):
> host    all         all         127.0.0.1/32          trust
>
> that should allows me (localhost) to access the database. Isn't right?

Yes, this is okay. Do you have an other line with host all all ... below
this line? Have you restart/reload the database after editing?


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: problem accessing a database

From
Luca Ferrari
Date:
On Friday 03 November 2006 16:17 A. Kretschmer's cat, walking on the keyboard,
wrote:
> Yes, this is okay. Do you have an other line with host all all ... below
> this line? Have you restart/reload the database after editing?


Of course I've a similar line for the ipv6 connections and the following is
the content of the pg_hba.conf file (the server has been restarted with the
hba_file option, so I'm sure this is the file it is using):

local   all         all                               ident sameuser
host    all         all         127.0.0.1/32          trust
host    all         all         ::1/128               trust

Any idea?

Luca

Re: problem accessing a database

From
Andreas Kretschmer
Date:
Luca Ferrari <fluca1978@infinito.it> schrieb:

> On Friday 03 November 2006 16:17 A. Kretschmer's cat, walking on the keyboard,
> wrote:
> > Yes, this is okay. Do you have an other line with host all all ... below
> > this line? Have you restart/reload the database after editing?
>
>
> Of course I've a similar line for the ipv6 connections and the following is
> the content of the pg_hba.conf file (the server has been restarted with the
> hba_file option, so I'm sure this is the file it is using):
>
> local   all         all                               ident sameuser

Ahhh....

try psql -h localhost ...


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

Re: problem accessing a database

From
Luca Ferrari
Date:
On Friday 03 November 2006 16:40 Andreas Kretschmer's cat, walking on the
keyboard, wrote:
>
> try psql -h localhost ...


That worked!
Thanks,
Luca

Re: problem accessing a database

From
"A. Kretschmer"
Date:
am  Fri, dem 03.11.2006, um 17:06:01 +0100 mailte Luca Ferrari folgendes:
> On Friday 03 November 2006 16:40 Andreas Kretschmer's cat, walking on the
> keyboard, wrote:
> >
> > try psql -h localhost ...
>
>
> That worked!
> Thanks,

Great, okay.

The reason is, without -h, psql connect to the db via a socket, not with
tcp/ip. With -h, you coerce psql to connect via tcp/ip, and now your
rules are okay. You can change your settings for local (change to trust)


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net