pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedPostgreSQL - How to login with my Linux user account
6+ messages / 4 participants
[nested] [flat]
* PostgreSQL - How to login with my Linux user account
@ 2023-07-28 00:19 Amn Ojee Uw <amnojeeuw@gmail.com>
0 siblings, 3 replies; 6+ messages in thread
From: Amn Ojee Uw @ 2023-07-28 00:19 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
I'd like to log into my newly installed PostgreSQL [ PostgreSQL 12.15
(Debian 12.15-1.pgdg120+1) ] using my linux account.
In trying to do that this web page
<https://alvinalexander.com/blog/post/postgresql/log-in-postgresql-database/>suggest
that I enter :
psql -d mydb -U myuser -W
However, that command requires a database_name (mydb), and PosgreSQL 12.15 being so freshly installed does not yet
have any database created by me.
How would you suggest I circumvent this challenge?
Mind you that, using the postgres account I have created other accounts.
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
chispa | Superuser | {}
pedro | Superuser | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
Thanks in advance.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: PostgreSQL - How to login with my Linux user account
@ 2023-07-28 00:23 David G. Johnston <david.g.johnston@gmail.com>
parent: Amn Ojee Uw <amnojeeuw@gmail.com>
2 siblings, 0 replies; 6+ messages in thread
From: David G. Johnston @ 2023-07-28 00:23 UTC (permalink / raw)
To: Amn Ojee Uw <amnojeeuw@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
On Thu, Jul 27, 2023 at 5:19 PM Amn Ojee Uw <amnojeeuw@gmail.com> wrote:
> However, that command requires a database_name (mydb), and PosgreSQL 12.15 being so freshly installed does not yet
> have any database created by me.
>
> So create some. Otherwise the only useful database name to specify would
be "postgres".
David J.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: PostgreSQL - How to login with my Linux user account
@ 2023-07-28 00:31 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Amn Ojee Uw <amnojeeuw@gmail.com>
2 siblings, 0 replies; 6+ messages in thread
From: Adrian Klaver @ 2023-07-28 00:31 UTC (permalink / raw)
To: Amn Ojee Uw <amnojeeuw@gmail.com>; pgsql-general@lists.postgresql.org
On 7/27/23 17:19, Amn Ojee Uw wrote:
> I'd like to log into my newly installed PostgreSQL [ PostgreSQL 12.15
> (Debian 12.15-1.pgdg120+1) ] using my linux account.
> In trying to do that this web page
> <https://alvinalexander.com/blog/post/postgresql/log-in-postgresql-database/>suggest that I enter :
>
> psql -d mydb -U myuser -W
>
> However, that command requires a database_name (mydb), and PosgreSQL 12.15 being so freshly installed does not yet
> have any database created by me.
>
> How would you suggest I circumvent this challenge?
The tutorial
https://www.postgresql.org/docs/current/tutorial.html
would be a good place to start.
From said tutorial:
https://www.postgresql.org/docs/current/tutorial-createdb.html
createdb mydb
Which in turn leads to:
https://www.postgresql.org/docs/current/app-createdb.html
>
> Mind you that, using the postgres account I have created other accounts.
>
>
> Role name | Attributes | Member of
> -----------+------------------------------------------------------------+-----------
> chispa | Superuser | {}
> pedro | Superuser | {}
> postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
>
>
> Thanks in advance.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: PostgreSQL - How to login with my Linux user account
@ 2023-07-28 14:00 Amn Ojee Uw <amnojeeuw@gmail.com>
parent: Amn Ojee Uw <amnojeeuw@gmail.com>
2 siblings, 2 replies; 6+ messages in thread
From: Amn Ojee Uw @ 2023-07-28 14:00 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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"*/
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: PostgreSQL - How to login with my Linux user account
@ 2023-07-28 14:44 Ron <ronljohnsonjr@gmail.com>
parent: Amn Ojee Uw <amnojeeuw@gmail.com>
1 sibling, 0 replies; 6+ messages in thread
From: Ron @ 2023-07-28 14:44 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 7/28/23 09: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"*/
>
> 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'?
>
https://www.postgresql.org/docs/12/auth-pg-hba-conf.html
You want peer authentication to be able to connect to postgresql as
my_linux_username.
--
Born in Arizona, moved to Babylonia.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: PostgreSQL - How to login with my Linux user account
@ 2023-07-28 14:48 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Amn Ojee Uw <amnojeeuw@gmail.com>
1 sibling, 0 replies; 6+ messages in thread
From: Adrian Klaver @ 2023-07-28 14:48 UTC (permalink / raw)
To: Amn Ojee Uw <amnojeeuw@gmail.com>; pgsql-general@lists.postgresql.org
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.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2023-07-28 14:48 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 00:19 PostgreSQL - How to login with my Linux user account Amn Ojee Uw <amnojeeuw@gmail.com>
2023-07-28 00:23 ` David G. Johnston <david.g.johnston@gmail.com>
2023-07-28 00:31 ` Adrian Klaver <adrian.klaver@aklaver.com>
2023-07-28 14:00 ` Amn Ojee Uw <amnojeeuw@gmail.com>
2023-07-28 14:44 ` Ron <ronljohnsonjr@gmail.com>
2023-07-28 14:48 ` Adrian Klaver <adrian.klaver@aklaver.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox