The shop on this server got a PostgreSQL database called shop and an account shop with a password. The shop application connects to the database at 127.0.0.1 and gets refused, although the service is running.
Repeat its attempt from the terminal. The shop password is in your ~/.pgpass file, and psql picks it up by itself. “Start” launches PostgreSQL and creates the databases.
Repeat the application's login
Check that the service is running and port 5432 is listening, then log in to the shop database as the shop role, the way the application does.
First, predict
What will psql answer?
Now start the exercise, run the command and compare your prediction with the output.
The service is active, port 5432 is listening, yet the shop login was refused. Where did the attempt stop?
-
The connection got through:
ssshowedLISTEN … 127.0.0.1:5432, and theFATAL: no pg_hba.conf entryline came from the server. -
systemctl is-active postgresqlprintedactive, and the server answered the connection, so the service is fine. -
The password is in
~/.pgpass, but it never got that far: the refusal says nothing about a password, onlyno pg_hba.conf entry.
The connection reached PostgreSQL, and the refusal was written by the server itself.