Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pgadmin3 server connection and authentication error

I have recently installed postgresql 9.1 and pgadmin3. But I can't connect to server which I created with this config:

name: mydb
host: 127.0.0.1
port: 5432
service: 
Maintenance DB: postgres
username: postgres
password: *

According to similar problems I've set my /etc/postgresql/9.1/main/pg_hba.conf file under ubuntu 12.04 LTS like this:

local   all             postgres                                md5

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

host    all             all             localhost               trust

But when I want to connect to the server I get this error:

Error connecting to the server: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"

like image 990
muradin Avatar asked Nov 04 '13 18:11

muradin


2 Answers

That was simple after installation of postgresql i should change the postgres user password and my failure was because of that. The password can simply change through this commands under ubuntu 12.04 LTS:

sudo -u postgres psql

And then in psql:

\password

Now enter the new password and re-enter it. That's OK! then you can simply sign in. This way there is no need to change the configuration of pg_hba.conf file.

In fact i failed to login because of my invalid password!

like image 194
muradin Avatar answered Oct 02 '22 14:10

muradin


Seems your DB is configured for "postgres" user and PgAdmin is trying to connect as "postgre" (without s in the end).

like image 34
Nailgun Avatar answered Oct 02 '22 14:10

Nailgun