Y
Y
Yourmind2019-10-16 15:40:40
PostgreSQL
Yourmind, 2019-10-16 15:40:40

Why can't I connect to postgres database?

[email protected]:~$ sudo -u postgres psql
psql (11.5 (Ubuntu 11.5-3.pgdg18.04+1))
Type "help" for help.
postgres=# select * from pg_database;
postgres=# create database secure;
CREATE DATABASE
postgres=# CREATE USER test_user WITH password 'qwerty';
CREATE ROLE
postgres=# GRANT ALL ON DATABASE secure TO test_user;
GRANT
postgres-# \q
[email protected]:~$ psql -h localhost secure test_user Test_user
password:
psql: FATAL: database "secure" does not exist
5da70f30c5dce816364790.png
even though select * from pg_database;
everything seems to be normal5da70fb1ccb47387735024.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
anikavoi, 2019-10-18
@anikavoi

psql -h localhost -d secure -U test_user
And look into hba at the same time

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question