Re: postgres 12 password failure port 5433
Zahid Rahman <[email protected]> Sun, 15 Dec 2019 16:50:13 +0000
| Newsgroups | gmane.comp.db.postgresql.novice |
|---|---|
| Message-ID | <CAPGSW3R0pZ=5y+msHWQumqM5bsdd_Ppyr_D5fu-baEvF6mFkaQ@mail.gmail.com> |
--00000000000030efb50599c0e491
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Programmatically:
LOG:
Opening database ....
time taken miiliseconds 257
closed database successfully
try {
System.out.println("Opening database ....");
Start =3D System.currentTimeMillis();
Connection conn =3D null;
Class.forName("org.postgresql.Driver");
conn =3D DriverManager
.getConnection("jdbc:postgresql://localhost:5433/events",
"postgres","sunrise");
conn.close();
On Sun, 15 Dec 2019 at 16:40, Efrain Dector <[email protected]> wrote:
> 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 an=
d
> 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 <
> [email protected]> escribi=C3=B3:
>
>> programmatically :
>>
>> try {
>> System.out.println("Opening database ....");
>> Start =3D System.currentTimeMillis();
>> Connection conn =3D null;
>> Class.forName("org.postgresql.Driver");
>> conn =3D 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(Connection=
FactoryImpl.java:520)
>> at
>> org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactor=
yImpl.java:141)
>> at
>> org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(Connecti=
onFactoryImpl.java:192)
>> at
>> org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.j=
ava: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 <[email protected]> wrote:
>>
>>> This is my ubuntu terminal prompt with root username.
>>>
>>> kub18@UB18:~
>>>
>>> I then types
>>>
>>>
>>> *kub18@UB18:~$ su - postgresPassword:postgres@UB18:~$ *
>>> As you can see the password for user 'postgres' have been accepted and
>>> the prompt has changed.
>>>
>>> I then typed:
>>> postgres@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 authenticatio=
n
>>> 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, <[email protected]> wrote:
>>>
>>>> Are you lagged in as postgres user or root? You need to be logged in a=
s
>>>> postgres in order to use psql.
>>>>
>>>> Just =E2=80=98su - postgres=E2=80=99 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 <[email protected]> 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 messag=
e
>>>>> psql: error: could not connect to server: FATAL: password authentica=
tion
>>>>> 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 pass=
word),
>>>>> or your browser doesn't understand how to supply the credentials requ=
ired.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
--00000000000030efb50599c0e491
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Programmatically:</div><div>LOG:<br></div><div>Openin=
g database ....<br>time taken miiliseconds 257<br>closed database successfu=
lly</div><div><br></div><div> =C2=A0 =C2=A0=C2=A0 try {<br> =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0System.out.println("Opening database ....&=
quot;);<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Start =3D System.curr=
entTimeMillis();<br> =C2=A0 =C2=A0 =C2=A0=C2=A0 Connection conn =3D null=
;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Class.forName("org.pos=
tgresql.Driver");<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0conn =
=3D DriverManager<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.getConnect=
ion("jdbc:postgresql://localhost:5433/events",<br> =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0"postgres","sunrise");<br> =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0conn.close();</div><div><br></div=
><div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Sun, 15 Dec 2019 at 16:40, Efrain Dector <<a href=3D"=
mailto:[email protected]">[email protected]</a>> wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:=
1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"auto">For local co=
nnections you have md5 You need put a password, if You can't put a pass=
word for local (127.0.0.1) You need put trust un pg_hba.conf and reload dil=
e<div dir=3D"auto"><br></div><div dir=3D"auto"><br></div><div dir=3D"auto">=
<span style=3D"font-family:sans-serif;font-size:12.8px">host =C2=A0 =C2=A0a=
ll =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 all =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0=C2=A0</span><a href=3D"http://127.0.0.1/32" style=3D"text=
-decoration-line:none;color:rgb(66,133,244);font-family:sans-serif;font-siz=
e:12.8px" target=3D"_blank">127.0.0.1/32</a><span style=3D"font-family:sans=
-serif;font-size:12.8px">=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0md5=
<--- change</span></div><div dir=3D"auto"><font face=3D"sans-serif"><sp=
an style=3D"font-size:12.8px"><br></span></font></div><div dir=3D"auto"><fo=
nt face=3D"sans-serif"><span style=3D"font-size:12.8px"><a href=3D"https://=
www.postgresql.org/docs/current/auth-pg-hba-conf.html" target=3D"_blank">ht=
tps://www.postgresql.org/docs/current/auth-pg-hba-conf.html</a></span><br><=
/font><div dir=3D"auto"><div dir=3D"auto"><br></div><div dir=3D"auto"><br><=
/div><div dir=3D"auto"><br></div></div></div></div><br><div class=3D"gmail_=
quote"><div dir=3D"ltr" class=3D"gmail_attr">El dom., 15 de dic. de 2019 10=
:24 a. m., Zahid Rahman <<a href=3D"mailto:[email protected]" rel=3D"=
noreferrer" target=3D"_blank">[email protected]</a>> escribi=C3=B3:<b=
r></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">=
<div>programmatically :</div><div><br></div><div>=C2=A0try {<br> =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0System.out.println("Opening database=
....");<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Start =3D Syste=
m.currentTimeMillis();<br> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 Connection conn =3D null;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0Class.forName("org.postgresql.Driver");<br> =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0conn =3D DriverManager<br> =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0.getConnection("jdbc:postgresql://localhost=
:5433/events",<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"pos=
tgres", "postgres");<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0conn.close();<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 <br> =C2=A0 =C2=A0 =
=C2=A0} catch (Exception e) {</div><div><br></div><div>Opening database ...=
.<br>org.postgresql.util.PSQLException: FATAL: password authentication fail=
ed for user "postgres"<br> at org.postgresql.core.v3.ConnectionFa=
ctoryImpl.doAuthentication(ConnectionFactoryImpl.java:520)<br> at org.postg=
resql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:1=
41)<br> at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(=
ConnectionFactoryImpl.java:192)<br> at org.postgresql.core.ConnectionFactor=
y.openConnection(ConnectionFactory.java:49)<br> at org.postgresql.jdbc.PgCo=
nnection.<init>(PgConnection.java:211)<br> at org.postgresql.Driver.m=
akeConnection(Driver.java:458)<br> at org.postgresql.Driver.connect(Driver.=
java:260)<br> at java.sql.DriverManager.getConnection(DriverManager.java:66=
4)<br> at java.sql.DriverManager.getConnection(DriverManager.java:247)<br> =
at PostgresJdbc.main(PostgresJdbc.java:15)<br>org.postgresql.util.PSQLExcep=
tion: FATAL: password authentication failed for user "postgres"</=
div><div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" cl=
ass=3D"gmail_attr">On Sun, 15 Dec 2019 at 16:10, Zahid Rahman <<a href=
=3D"mailto:[email protected]" rel=3D"noreferrer noreferrer" target=3D"_b=
lank">[email protected]</a>> wrote:<br></div><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"auto"><div style=3D"=
font-family:sans-serif;font-size:12.8px" dir=3D"auto">This is my ubuntu ter=
minal prompt with root username.</div><div style=3D"font-family:sans-serif;=
font-size:12.8px" dir=3D"auto"><br></div><div style=3D"font-family:sans-ser=
if;font-size:12.8px" dir=3D"auto">kub18@UB18:~</div><div style=3D"font-fami=
ly:sans-serif;font-size:12.8px" dir=3D"auto"><br></div><div style=3D"font-f=
amily:sans-serif;font-size:12.8px" dir=3D"auto">I then types=C2=A0</div><di=
v style=3D"font-family:sans-serif;font-size:12.8px" dir=3D"auto"><i>kub18@U=
B18:~$ su - postgres<br>Password:<br>postgres@UB18:~$=C2=A0</i></div><div s=
tyle=3D"font-family:sans-serif;font-size:12.8px" dir=3D"auto">As you can se=
e the password for user 'postgres' have been accepted and the promp=
t has changed.</div><div style=3D"font-family:sans-serif;font-size:12.8px" =
dir=3D"auto"><br></div><div style=3D"font-family:sans-serif;font-size:12.8p=
x" dir=3D"auto">I then typed:</div><div style=3D"font-family:sans-serif;fon=
t-size:12.8px" dir=3D"auto">postgres@UB18:~$ psql -p 5433 -h localhost</div=
><div style=3D"font-family:sans-serif;font-size:12.8px" dir=3D"auto">i am t=
hen prompted for postgres password</div><div style=3D"font-family:sans-seri=
f;font-size:12.8px" dir=3D"auto"><br></div><div style=3D"font-family:sans-s=
erif;font-size:12.8px" dir=3D"auto"><i>Password for user postgres:</i></div=
><div style=3D"font-family:sans-serif;font-size:12.8px" dir=3D"auto"><br></=
div><div style=3D"font-family:sans-serif;font-size:12.8px" dir=3D"auto">I t=
hen typed password<br></div><div style=3D"font-family:sans-serif;font-size:=
12.8px" dir=3D"auto">the error message=C2=A0<br></div><div style=3D"font-fa=
mily:sans-serif;font-size:12.8px" dir=3D"auto"><i>psql: error: could not co=
nnect to server: FATAL: =C2=A0password authentication failed for user "=
;postgres"<br>FATAL: =C2=A0password authentication failed for user &qu=
ot;postgres"</i></div><div style=3D"font-family:sans-serif;font-size:1=
2.8px"><br></div><div style=3D"font-family:sans-serif;font-size:12.8px">res=
ult of=C2=A0 sudo cat /etc/postgresql/12/main/pg_hba.conf</div><div style=
=3D"font-family:sans-serif;font-size:12.8px">I have not included the commen=
t header.</div><div style=3D"font-family:sans-serif;font-size:12.8px"><br><=
/div><div style=3D"font-family:sans-serif;font-size:12.8px" dir=3D"auto"># =
Database administrative login by Unix domain socket<br>local =C2=A0 all =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 postgres =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0peer<br><br># TYPE =C2=A0DATABASE =C2=A0 =C2=A0 =C2=A0 =C2=A0USER=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ADDRESS =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 METHOD<br><br># "local" is for Un=
ix domain socket connections only<br>local =C2=A0 all =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 all =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 peer<br># IPv4 local connections:<br>host =C2=A0 =C2=A0all =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 all =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 <a href=3D"http://127.0.0.1/32" rel=3D"noreferrer noreferrer" target=3D=
"_blank">127.0.0.1/32</a> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0md5<br>#=
IPv6 local connections:<br>host =C2=A0 =C2=A0all =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 all =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ::1/128 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 md5<br># Allow replica=
tion connections from localhost, by a user with the<br># replication privil=
ege.<br>local =C2=A0 replication =C2=A0 =C2=A0 all =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 peer<br>host =C2=A0 =C2=A0replication =C2=A0 =
=C2=A0 all =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"http://127.=
0.0.1/32" rel=3D"noreferrer noreferrer" target=3D"_blank">127.0.0.1/32</a> =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0md5<br>host =C2=A0 =C2=A0replicati=
on =C2=A0 =C2=A0 all =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ::1/128 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 md5<br></div><div styl=
e=3D"font-family:sans-serif;font-size:12.8px" dir=3D"auto"><br></div></div>=
</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=
On Sun, 15 Dec 2019, 15:34 Arlindo Neto, <<a href=3D"mailto:neto.acs@gma=
il.com" rel=3D"noreferrer noreferrer" target=3D"_blank">[email protected]<=
/a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0=
px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><=
div><div dir=3D"auto">Are you lagged in as postgres user or root? You need =
to be logged in as postgres in order to use psql.</div></div><div dir=3D"au=
to"><br></div><div dir=3D"auto">Just =E2=80=98su - postgres=E2=80=99 as roo=
t and try to use psql again.</div><div dir=3D"auto">If it still doesn't=
work, send us your /etc/postgresql/11/main/pg_hba.conf=C2=A0</div><div><br=
><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sun, 1=
5 Dec 2019 at 12:19 Zahid Rahman <<a href=3D"mailto:[email protected]=
" rel=3D"noreferrer noreferrer noreferrer" target=3D"_blank">zahidr1000@gma=
il.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><div>Hi,</div><div>I have postgres =
10 running on 5432 and pgadmin is connecting=C2=A0 ok.</div><div><br></div>=
<div>=C2=A0I have just installed postgres 12 on ubuntu 18.04=C2=A0 using ap=
t-get install<br></div><div>I have the following=C2=A0 success messages (se=
e below)</div><div>I have verified that I have a database running at 5433 p=
rogrammatically.</div><div>The PGADMIN4 "postgres admin tool" is =
giving an error "UNAUTHORISED message (see below)<br></div><div><h1><s=
pan style=3D"font-weight:normal"><font size=3D"2">WHEN i TRY TO LOGIN USING=
=C2=A0 PSQL CONSOLE using command line <br></font></span></h1><h1><span sty=
le=3D"font-weight:normal"><font size=3D"2">psql -U postgres =C2=A0-p 5433 -=
h localhost</font></span></h1><h1><span style=3D"font-weight:normal"><font =
size=3D"2">I get an password=C2=A0 error message</font></span><font size=3D=
"1"> psql: error: could not connect to server: FATAL: =C2=A0password authen=
tication failed for user "postgres"</font><br></h1><div>FATAL: =
=C2=A0password authentication failed for user "postgres"<br></div=
><div><br></div><h1>Unauthorized</h1>
<p>The server could not verify that you are authorized to access the URL
requested. You either supplied the wrong credentials (e.g. a bad=20
password), or your browser doesn't understand how to supply the=20
credentials required.</p></div><div> <br></div><div><br></div><div><br></di=
v><div> <br></div><div><br></div><div><br></div><div>Success. You can now s=
tart the database server using: <br>pg_ctlcluster 12 main start<br><br>Ver =
Cluster Port Status Owner =C2=A0 =C2=A0Data directory =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0Log file<br>12 =C2=A0main =C2=A0 =C2=A05433 down=
=C2=A0 postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql=
-12-main.log</div><div><br></div><div><br></div><div><br></div><div> <br></=
div><div><br></div><div><br></div></div></div>
</blockquote></div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
--00000000000030efb50599c0e491--