ALTER USER owr WITH PASSWORD 'owrPASSWORD'; Does not help.

When I psql -W -U owr I get the error psql: FATAL: Peer authentication failed for user "owr"

I tried different things from the Internet, but nothing helped.

    1 answer 1

    psql: FATAL: Peer authentication failed for user "owr"

    This error indicates that the owr user does not exist on the server (and not in the database), this is how the peer method is used to connect to the database, which uses users that already exist in the OS itself as the database users for authentication.

    In this case, it is necessary to use the password method in order to be able to set a password when entering the database. All this is configured in the pg_hba.conf file , in Debian, for example, it is located along this path:

     /etc/postgresql/9.4/main 

    In which it is necessary to correct this line:

     local all all peer 

    on

     local all all password 

    After that we apply the new settings: sudo service postgresql reload