From: Frank Finner <postgresql@finner.de>
To: pgsql-general@lists.postgresql.org
Subject: Re: Why password authentication failed for user "postgres"?
Date: Sun, 05 Jun 2022 23:06:27 -0000
Message-ID: <c9a1376f-1692-8ddc-af30-c1f6f5a0ef03@finner.de> (raw)
References: <TYAP286MB06367FE5D4BB0EE26F8D313FA9A19@TYAP286MB0636.JPNP286.PROD.OUTLOOK.COM>
On 2022-06-04 00:32, BeginnerC wrote:
> Hello everyone,
> I am a newbie to the postgres,when I use the psql to connect to the
> postgres,a error message printed:
> These command list like this:
>
> psql -U postgres
> Password for user postgres:postgres
> *postgreSQL: password authentication failed for user "postgres"*
> *
> *
> How to solve this problem?
> Thanks in advance!
* Which OS are you working on?
* Can you show us your pg_hba.conf?
If you use -U with psql, the connection must not try to use method
"peer" (which means "use the system user with this name", but also means
"You must be logged in with the system user corresponding to the
postgresql user"), but some kind of authorization, like md5, and use it
with IP address. This might be difficult for the user postgres, who
often has no password set in the database. If you really need to connect
with user postgres and some password, you can set one using the method
described by Reid Thompson.
Regards,
Frank
Attachments:
OpenPGP_0xE5418B2366C33EE6.asc (application/pgp-keys, 627B) download
OpenPGP_signature (application/pgp-signature, 235B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: postgresql@finner.de
Subject: Re: Why password authentication failed for user "postgres"?
In-Reply-To: <c9a1376f-1692-8ddc-af30-c1f6f5a0ef03@finner.de>
References: <TYAP286MB06367FE5D4BB0EE26F8D313FA9A19@TYAP286MB0636.JPNP286.PROD.OUTLOOK.COM> <c9a1376f-1692-8ddc-af30-c1f6f5a0ef03@finner.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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