I installed posgresql based on the ubuntu instructions. I registered the necessary parameters in the file just as in the instructions. Now when I try to connect via psql, everything is fine.

When I try to connect via pgadmin with a similar user, I get an error

FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres", SSL on FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres ", SSL off

Googled, it is advised to register in pg_hba.conf not a line as indicated in the instruction, but

local all postgres 127.0.0.1 md5 

In this case, I can not connect from the console gives an error:

 psql: could not connect to server: Нет такого файла или каталога Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? 

Tell me, how can I bring it up so that I can create my databases, labels and work with it on the server?

  • And you both left the line in kinfig? - Mike
  • No, only one - Alexandr
  • And you both write. each line is responsible for its own. That that was for return through unix a socket. And the second through tcp / ip (within the local machine) - Mike
  • no, this is not working - Alexandr

1 answer 1

 local all postgres 127.0.0.1 md5 

The string is specified twice incorrectly. If you did reload - there will be a message in the log and this file will not be used. If you tried to restart , the base will turn off and something like this will not start with an error:

 2018-12-07 14:15:07.271 MSK [7544] LOG: invalid authentication method "127.0.0.1" 2018-12-07 14:15:07.271 MSK [7544] CONTEXT: line 100 of configuration file "/etc/postgresql/11/main/pg_hba.conf" 2018-12-07 14:15:07.271 MSK [7544] FATAL: could not load pg_hba.conf 

Because local is unixsock , it cannot have an IP address.

The second error is in the address itself: the IP must be specified with the network mask.

 invalid IP mask "md5": Name or service not known 

It is unclear what the final result was in your pg_hba.conf

If you want access only by password on the local host, then you need 3 lines:

 local all all md5 host all all 127.0.0.1/32 md5 host all all ::1/128 md5 

For unixsock , ipv4 and ipv6 respectively.

Also note that the package maintainer assumes that the postgres user has non-interactive access to the database for scripts. Accordingly, if you block access with a password, something can be broken off and it makes sense to place the homedir file with the current password in the homedir postgres user.