pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to behive if I remove password from postgres role
3+ messages / 3 participants
[nested] [flat]

* How to behive if I remove password from postgres role
@ 2023-03-15 16:02  Raivo Rebane <raivore55@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Raivo Rebane @ 2023-03-15 16:02 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

HI

I wanted to install PostGIS Bundle so that it builds a sample spatial
database, but got error - createdb: error: connection to server at
"localhost" (::1), port 5432 failed: FATAL:  password authentication failed
for user "postgres"
Then I altered role of postgres so, that password = NULL.
Now I am in situation that I can't run any postgres command.
What I must to do ?

Regards,
Raivo

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to behive if I remove password from postgres role
@ 2023-03-15 16:12  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Raivo Rebane <raivore55@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Adrian Klaver @ 2023-03-15 16:12 UTC (permalink / raw)
  To: Raivo Rebane <raivore55@gmail.com>; pgsql-general@lists.postgresql.org

On 3/15/23 09:02, Raivo Rebane wrote:
> HI
> 
> I wanted to install PostGIS Bundle so that it builds a sample spatial 
> database, but got error - createdb: error: connection to server at 
> "localhost" (::1), port 5432 failed: FATAL:  password authentication 
> failed for user "postgres"
> Then I altered role of postgres so, that password = NULL.
> Now I am in situation that I can't run any postgres command.
> What I must to do ?

Edit the 
pg_hba.conf(https://www.postgresql.org/docs/15/auth-pg-hba-conf.html) so 
that the first local line is set to trust as in the 'Example 21.1. 
Example pg_hba.conf Entries' at the bottom of the file. It may already 
be set that way.

In either case when you connect do not use a host setting e.g. do not do 
host=localhost. This will ensure you are connecting to the local socket 
instead and will be using the trust authentication method and not a 
password. Once you are in you can alter the postgres user to have a 
proper password.

> 
> Regards,
> Raivo
> 
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to behive if I remove password from postgres role
@ 2023-03-15 16:12  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Raivo Rebane <raivore55@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2023-03-15 16:12 UTC (permalink / raw)
  To: Raivo Rebane <raivore55@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Raivo Rebane <raivore55@gmail.com> writes:
> Then I altered role of postgres so, that password = NULL.
> Now I am in situation that I can't run any postgres command.
> What I must to do ?

Stop the server, start it in single-user mode (postgres --single),
issue an ALTER USER command to undo the damage.

Or modify pg_hba.conf to let you in without a password.  Local
peer auth, for example, is perfectly secure.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2023-03-15 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 16:02 How to behive if I remove password from postgres role Raivo Rebane <raivore55@gmail.com>
2023-03-15 16:12 ` Adrian Klaver <adrian.klaver@aklaver.com>
2023-03-15 16:12 ` Tom Lane <tgl@sss.pgh.pa.us>

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