Re: PostgreSQL - How to login with my Linux user account

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Amn Ojee Uw <amnojeeuw(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL - How to login with my Linux user account
Date: 2023-07-28 14:48:34
Message-ID: bce6ddd1-f69e-08b7-6424-fa56e760617c@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/28/23 07:00, Amn Ojee Uw wrote:
> First of all, my gratitude to Adrian and David for taking the time to
> reply to my call for help; a 1k  thanks to you kids.
>
> Having stated the above, PostgreSQL provides a default database namely
> 'postgres'. Taking advantage of this service, I have change the 'psql'
> statement to 'psql -d postgres -U my_linux_user_name -W', I then entered
> my Linux account login password and got this error messages :
> /*$ psql -d postgres -U my_linux_user_name -W *//*
> *//*Password: *//*
> *//*psql: error: connection to server on socket
> "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  Peer authentication
> failed for user "my_linux_user_name"*/

1) See

https://www.postgresql.org/docs/current/auth-peer.html

2) What OS are you on and how did you install Postgres?

3) Try

sudo -u postgres psql postgres

4) Provide the content of pg_hba.conf that starts at the line below

# TYPE DATABASE USER ADDRESS METHOD

...

>
> I also, using 'postres' account, have created another user account,
> chispa, who is a superuser; when trying to login as 'chispa' and using
> the above statement (/*psql -d postgres -U chispa -W *//*)*/ PostgreSQL
> throws the same error message.
> /**/
>
> What am I doing wrong?
> Is there a webpage that explains how to login to PostgreSQL as other
> than 'postgres'?
>
>
> Thanks in advance.
>
> On 7/27/23 8:19 p.m., Amn Ojee Uw wrote:
>> psql -d mydb -U myuser -W

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2023-07-28 14:50:21 Re: impact pgbench on a physical replicated stream
Previous Message Ron 2023-07-28 14:44:37 Re: PostgreSQL - How to login with my Linux user account