Skip site navigation (1) Skip section navigation (2)

Re: Problems using PostgreSQL command line tools

From: "Guido Barosio" <gbarosio(at)gmail(dot)com>
To: Andrea <andrea(dot)b73(at)email(dot)it>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Problems using PostgreSQL command line tools
Date: 2006-03-23 14:30:34
Message-ID: f7f6b4c70603230630r25f16d59y7f7f1955fc82f314@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi Andrea,

   You should try to connect to 127.0.0.1 (or your hostname)  instead
of localhost.

why?

- localhost means that you will connect using a socket (psql -h localhost)
- ip/hostname will use tcp/ip (psql -h 127.0.0.1)

Both have separate auth lines in your pg_hba.conf, therefore, you are
prolly facing a problem with the localhost line, where pgadmin is
connecting using the tcp/ip connection for sure.

Check that, but I am almost sure.

Regards,
Guido Barosio

On 3/23/06, Andrea <andrea(dot)b73(at)email(dot)it> wrote:
> Hi to all in the mailing-list! I am new and I have problems with command
> line tools of PostgreSQL.
>
> I have 2 computers, one at home and one at office. Both computers are
> equipped with Windows 2000 Professional SP4. On both computers I have
> installed PostgreSQL 8.1.3-1 (the latest at this moment).
> Both installations are "clean", I have NOT modified any PostgreSQL
> configuration file!
>
> At home (where I have no problems), I can do:
> -----------from console-----------
> C:\>psql -h localhost -U postgres -d postgres
> Password for user postgres:
> Welcome to psql 8.1.3, the PostgreSQL interactive terminal.
>
>    [....]
>
> postgres=#
> ----------------------------------
>
> At office, if I try to do the same thing, I get:
> -----------from console-----------
> C:\>psql -h localhost -U postgres -d postgres
> psql: FATAL:  password authentication failed for user "postgres"
> ----------------------------------
>
> In practice, psql doesn't ask me the password and fails immediately!
> But note this (the first strange thing), I have NO problems connecting
> to PostgreSQL server using pgAdmin III tool and also from PHP4/PHP5
> scripts (I develop on web with Apache and PHP4/5).
>
> For example I have tried the following PHP script:
> -----------code-----------
> <h1>PostgreSQL connection test</h1>
> <?php
> $dbconn = pg_connect ("host=localhost dbname=postgres user=postgres
> password=pgpw")
>     or die ('Connect error: ' . pg_last_error ());
>
> pg_close ($dbconn);
> ?>
> <h3>Connected!</h3>
> --------------------------
> And in the web browser I see "Connected!", so connection to PostgreSQL
> is ok!
>
> I am NOT able to connect to server using all command line tools like
> psql, createuser, createdb, etc...
>
> Can someone help me?? What could be wrong on my computer at office???
> Thanks in advance and sorry if my english is not perfect!
>
> Andrea
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org
>


--
Guido Barosio
-----------------------

In response to

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2006-03-23 15:26:54
Subject: Re: Problems using PostgreSQL command line tools
Previous:From: Lane Van IngenDate: 2006-03-23 13:44:11
Subject: Cooked vs Raw Disk Space

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group