Postgres password authentication fails

后端 未结 4 816
终归单人心
终归单人心 2020-11-27 15:34

I tried to login with the postgres user from my windows machine to my server with Pgadmin.

But it keeps giving me this error:

psql: FATAL:  password          


        
4条回答
  •  感情败类
    2020-11-27 16:29

    Assuming, that you have root access on the box you can do:

    sudo -u postgres psql
    

    If that fails with a database "postgres" does not exists this block.

    sudo -u postgres psql template1
    

    Then sudo nano /etc/postgresql/11/main/pg_hba.conf file

    local   all         postgres                          ident
    

    For newer versions of PostgreSQL ident actually might be peer.

    Inside the psql shell you can give the DB user postgres a password:

    ALTER USER postgres PASSWORD 'newPassword';
    

提交回复
热议问题