The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PostgresSQL, authentication failed

Discussion in 'Database Discussions' started by andrew green, Jun 3, 2009.

  1. andrew green

    andrew green Member

    Joined:
    Apr 5, 2009
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Hi There,

    Just installed postgresql and rebuilt apache enabling PostgresSQL.

    I now have a 2 issues.

    1. Cant authenticate a user connecting from a PHP script.
    Very simple code,
    pg_connect("host=localhost port=5432 dbname=envirote_test user=envirote_test password=test");

    error is:
    Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: Ident authentication failed for user "envirote_test" in /home/envirote/public_html/test.php on line 3

    I know my script can find postgre because a different error is returned if you change the host value.

    Updating pg_hba.conf with:
    local all all trust

    then command
    pg_ctl reload -D /blah/blah

    does nothing.

    Any suggestions?

    On a second note, when creating a new user from CPanel, create db, add user to db. When logging into phpPgAdmin, the database does not display. It only displays if I log in using the cpanel username and pw. Even it I SSH and grant all priveliges to my user on the database in question, the db does not diaply at all in phpPgAdmin.

    Any suggestions would be much appreciated, mainly the damn connection not working. I can live having to SSH to access the DB.
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I recommend letting our technical analysts take a look at this for you: http://tickets.cPanel.net/submit
     
  3. claudio

    claudio Well-Known Member

    Joined:
    Jul 31, 2004
    Messages:
    201
    Likes Received:
    0
    Trophy Points:
    16
    Hi

    for anyone having this issue i found a solution at other website quite obvious:

    To fix this error open PostgreSQL client authentication configuration file /var/lib/pgsql/data/pg_hba.conf :

    pico /var/lib/pgsql/data/pg_hba.conf

    By default Postgresql uses IDENT-based authentication. All you have to do is allow username and password based authentication for your network or webserver. IDENT will never allow you to login via -U and -W options. Append following to allow login via localhost only:

    local all all trust
    host all 127.0.0.1/32 trust

    Save and close the file. Restart Postgresql server:

    # service postgresql restart

    kind regards
    Claudio
     
    #3 claudio, Oct 16, 2009
    Last edited: Oct 16, 2009
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    You (and others reading this thread) may find this recent and related post helpful: http://forums.cpanel.net/580757-post7.html
     
  5. asent

    asent Active Member

    Joined:
    Apr 5, 2005
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    That doesn't fix the login issue. Mine is set to md5 also. Still cannot login to pgadmin. Ran all configs, set passwords, nothing...
     
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    In that case, please let our technical analysts take a look at the server so we can correct this situation.
     
  7. asent

    asent Active Member

    Joined:
    Apr 5, 2005
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    It's co-lo, i do not own the license, the DC does so I cannot open a ticket and they do not seem they really want to open one. This issue is obviously affecting many which can be seen by searching these boards. Why can't it just work the way it's supposed to? If someone from cpanel sees there's an issue, it should be addressed.

    /scripts/installpostgres does not seem to cut it. Did a clean install on a new server with a fresh cpanel install and logins do not work. Is it a TCP issue? Tried adding -i to postmaster in the /etc/rc.d/init.d/postgresql. That solved issues on past version 7. Does not seem to be the case now.

    EDIT: Had some time to look though the configs and got it working tonight.

    What I did:

    Edit pg_hba.conf and comment out these lines:
    local all all ident sameuser
    host all all 127.0.0.1/32 ident sameuser

    and add it not exists these lines:
    local all all md5
    host all all 127.0.0.1/32 md5

    That fixed my ident issues.

    Thanks
     
    #7 asent, Dec 6, 2009
    Last edited: Dec 13, 2009
Loading...
Similar Threads - PostgresSQL authentication failed
  1. musioc
    Replies:
    1
    Views:
    2,620

Share This Page