#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Calgary, Canada
    Posts
    28
    Rep Power
    0

    cannot login to postgreSQL


    Suddenly I am having troubles logging into pg. I have been debugging my first PHP script and realized that most of my problems revolved around tcp/ip and user permissions. While I was setting things I broke something.

    command:
    psql -h 127.0.0.1 -d store -U postgres -W

    error:
    psql: FATAL 1: Password authentication failed for user "postgres"

    I have no problems logging in if I change the pg_hba.conf to trusted, but don't think its a good idea to leave it like that ...

    I have tried altering the postgres's password:

    alter user postgres password 'helloworld';

    That did not seem to make a difference.

    I am using pgSQL 7.2 on windows, incase that makes a difference.

    Any ideas?
  2. #2
  3. Me likey breadsticks...
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    1,189
    Rep Power
    18
    What did it say when you did the ALTER USER command? Also, can you list what's in your pg_hba.conf that is uncommented?

    -b
    PostgreSQL, it's what's for dinner...
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Calgary, Canada
    Posts
    28
    Rep Power
    0
    Oh, so you wanted to have all of the useful information...

    This is the working configuration. I have no problem logging in with the webpage or psql with this configuration:
    Code:
    # TYPE     DATABASE    IP_ADDRESS    MASK               AUTH_TYPE  AUTH_ARGUMENT
    
    local      all                                          trust
    host       all           127.0.0.1   255.255.255.255    trust
    host       store       ***.***.*.*   255.255.255.255    password
    This is the broken configuration. Using this configuration, my webpage connects, but psql gives the error.
    Code:
    # TYPE     DATABASE    IP_ADDRESS    MASK               AUTH_TYPE  AUTH_ARGUMENT
    
    local      all                                          password
    host       all           127.0.0.1   255.255.255.255    password
    host       store       ***.***.*.*   255.255.255.255    password
    When I ran the alter statement, I got (what looked like) the confirmation message:
    Code:
    ALTER USER
  6. #4
  7. Me likey breadsticks...
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    1,189
    Rep Power
    18
    Your webpage connects correctly as postgres, but psql doesn't with the second pg_hba.conf setup ?

    That's very odd. From your syntax it looks like your trying to connect to the server over tcp both from the web page and psql (since you're specifiying the host when trying to connect) so there shouldn't be a difference.

    Sorry I can't be of more help, I'll see if I can dig anything up in the docs or newsgroups.

    -b
    PostgreSQL, it's what's for dinner...
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Calgary, Canada
    Posts
    28
    Rep Power
    0
    Don't worry about it too much. Currently, the database resides on a computer that I am the only user of. While I am not the only person that has access to it, I am the only person that uses it.

    For now I will use a trusted connection for local logins. When I move the database I will worry about security a little more.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Calgary, Canada
    Posts
    28
    Rep Power
    0
    Oh ya... Thanks a lot.

    At least I know that I am not being totally stupid and missing something obvious.

IMN logo majestic logo threadwatch logo seochat tools logo