Re: postgres 12 password failure port 5433

From: Efrain Dector <admin(at)motumweb(dot)com>
To: Zahid Rahman <zahidr1000(at)gmail(dot)com>
Cc: Arlindo Neto <neto(dot)acs(at)gmail(dot)com>, pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: postgres 12 password failure port 5433
Date: 2019-12-15 16:40:01
Message-ID: CAH78cDq2hhBQhM43KN4xr5sDdFAAUY5+rBOz2aeJoQq8gUE0zQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

For local connections you have md5 You need put a password, if You can't
put a password for local (127.0.0.1) You need put trust un pg_hba.conf and
reload dile

host all all 127.0.0.1/32 md5 <---
change

https://www.postgresql.org/docs/current/auth-pg-hba-conf.html

El dom., 15 de dic. de 2019 10:24 a. m., Zahid Rahman <zahidr1000(at)gmail(dot)com>
escribió:

> programmatically :
>
> try {
> System.out.println("Opening database ....");
> Start = System.currentTimeMillis();
> Connection conn = null;
> Class.forName("org.postgresql.Driver");
> conn = DriverManager
> .getConnection("jdbc:postgresql://localhost:5433/events",
> "postgres", "postgres");
> conn.close();
>
> } catch (Exception e) {
>
> Opening database ....
> org.postgresql.util.PSQLException: FATAL: password authentication failed
> for user "postgres"
> at
> org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:520)
> at
> org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:141)
> at
> org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
> at
> org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
> at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:211)
> at org.postgresql.Driver.makeConnection(Driver.java:458)
> at org.postgresql.Driver.connect(Driver.java:260)
> at java.sql.DriverManager.getConnection(DriverManager.java:664)
> at java.sql.DriverManager.getConnection(DriverManager.java:247)
> at PostgresJdbc.main(PostgresJdbc.java:15)
> org.postgresql.util.PSQLException: FATAL: password authentication failed
> for user "postgres"
>
>
> On Sun, 15 Dec 2019 at 16:10, Zahid Rahman <zahidr1000(at)gmail(dot)com> wrote:
>
>> This is my ubuntu terminal prompt with root username.
>>
>> kub18(at)UB18:~
>>
>> I then types
>>
>>
>> *kub18(at)UB18:~$ su - postgresPassword:postgres(at)UB18:~$ *
>> As you can see the password for user 'postgres' have been accepted and
>> the prompt has changed.
>>
>> I then typed:
>> postgres(at)UB18:~$ psql -p 5433 -h localhost
>> i am then prompted for postgres password
>>
>> *Password for user postgres:*
>>
>> I then typed password
>> the error message
>>
>> *psql: error: could not connect to server: FATAL: password
>> authentication failed for user "postgres"FATAL: password authentication
>> failed for user "postgres"*
>>
>> result of sudo cat /etc/postgresql/12/main/pg_hba.conf
>> I have not included the comment header.
>>
>> # Database administrative login by Unix domain socket
>> local all postgres peer
>>
>> # TYPE DATABASE USER ADDRESS METHOD
>>
>> # "local" is for Unix domain socket connections only
>> local all all peer
>> # IPv4 local connections:
>> host all all 127.0.0.1/32 md5
>> # IPv6 local connections:
>> host all all ::1/128 md5
>> # Allow replication connections from localhost, by a user with the
>> # replication privilege.
>> local replication all peer
>> host replication all 127.0.0.1/32 md5
>> host replication all ::1/128 md5
>>
>>
>> On Sun, 15 Dec 2019, 15:34 Arlindo Neto, <neto(dot)acs(at)gmail(dot)com> wrote:
>>
>>> Are you lagged in as postgres user or root? You need to be logged in as
>>> postgres in order to use psql.
>>>
>>> Just ‘su - postgres’ as root and try to use psql again.
>>> If it still doesn't work, send us your
>>> /etc/postgresql/11/main/pg_hba.conf
>>>
>>> On Sun, 15 Dec 2019 at 12:19 Zahid Rahman <zahidr1000(at)gmail(dot)com> wrote:
>>>
>>>> Hi,
>>>> I have postgres 10 running on 5432 and pgadmin is connecting ok.
>>>>
>>>> I have just installed postgres 12 on ubuntu 18.04 using apt-get
>>>> install
>>>> I have the following success messages (see below)
>>>> I have verified that I have a database running at 5433 programmatically.
>>>> The PGADMIN4 "postgres admin tool" is giving an error "UNAUTHORISED
>>>> message (see below)
>>>> WHEN i TRY TO LOGIN USING PSQL CONSOLE using command line
>>>> psql -U postgres -p 5433 -h localhostI get an password error message
>>>> psql: error: could not connect to server: FATAL: password authentication
>>>> failed for user "postgres"
>>>> FATAL: password authentication failed for user "postgres"
>>>>
>>>> Unauthorized
>>>>
>>>> The server could not verify that you are authorized to access the URL
>>>> requested. You either supplied the wrong credentials (e.g. a bad password),
>>>> or your browser doesn't understand how to supply the credentials required.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Success. You can now start the database server using:
>>>> pg_ctlcluster 12 main start
>>>>
>>>> Ver Cluster Port Status Owner Data directory Log file
>>>> 12 main 5433 down postgres /var/lib/postgresql/12/main
>>>> /var/log/postgresql/postgresql-12-main.log
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Zahid Rahman 2019-12-15 16:40:51 Re: postgres 12 password failure port 5433
Previous Message Zahid Rahman 2019-12-15 16:24:08 Re: postgres 12 password failure port 5433