could not connect to server

From: Antonio Silva <aolinto(dot)lst(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: could not connect to server
Date: 2016-10-15 17:11:01
Message-ID: CAE8g1gMQJ4uhpNZDZpn9JdKXdaE2d4V-OLeGcvKOdQgB3u7SAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

I'm using postgres 9.5 on Ubuntu 16.04. I have worked with pg in my
notebook for almost a month but today postgres did not connected. I tryed
both PGAdmin and psql.

I also tried to login using my own user and postgres but I received the
messages:

Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Conexão recusada (connection refused) Is the
server running on host "127.0.0.1" and accepting TCP/IP connections on port
5432?

~$ psql database
WARNING: password file "/home/antonio/.pgpass" has group or world access;
permissions should be u=rw (0600) or less
psql: could not connect to server: Arquivo ou diretório não encontrado
(File or directory not found)
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

$ pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
9.5 main 5432 down postgres /var/lib/postgresql/9.5/main
/var/log/postgresql/postgresql-9.5-main.log

It was the first time I received the warning "password file
"/home/antonio/.pgpass" has group or world access; permissions should be
u=rw (0600) or less" and I fixed it:
-rw------- 1 antonio antonio 137 Set 30 18:50 .pgpass

I had edited postgresql.conf and pg_hba.conf but this morning they were in
their original configuration. So I edited again to:

/etc/postgresql/9.5/main/postgresql.conf

# - Connection Settings -
listen_addresses = '*'
port = 5432

/etc/postgresql/9.5/main/pg_hba.conf

# Database administrative login by Unix domain socket
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

I also restarted the server (/etc/init.d/postgresql restart) and the
computer.

I really appreciate any guidance.

All the best,

Antônio Olinto
São Paulo, Brasil

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-10-15 17:28:53 Re: could not connect to server
Previous Message Michael Paquier 2016-10-15 05:52:04 Re: journaled FS and and WAL