6

I have initialized a pg database as such:

user_name@my_machine$ sudo -u postgres createuser -s user_name
user_name@my_machine$ createdb -T template0 db_name

I can now connect to it via psql via user_name@my_machine$ psql db_name
and everything works well with the CLI tooling.

The relevant auth line of /etc/postgresql/13/main/pg_hba.conf is:
local all all peer

Now I'd like to connect to it via PgAdmin 4, and I can't find a way to tell the interface that I want to connect via unix socket and don't need a password. The sanest way I can think is:
Connection dialogAdvanced Dialog

but the connection is still rejected with a fe_sendauth: no password supplied.

I know I could configure a password for my user and give it, but I'd like to know if I can make PgAdmin behave properly.

3
  • @Steeeve that solved the issue. Wouldn't have guessed it, with the documentation promising that <empty hostname> = <default unix socket>. Please make an answer, I'll accept it. Commented Sep 19, 2021 at 14:18
  • But what documentation? Leaving both host fields empty would work (on Linux), if PgAdmin4 didn't go out of its way to disable it. Commented Sep 19, 2021 at 14:29
  • @jjanes I can't find it anymore, I may have confused some SO posts with the official docs, which do state that you can use an address or a unix socket, but say nothing about leaving it empty. It's not ideal, but I don't plan on changing the default socket ever, so it's fine this way Commented Sep 19, 2021 at 14:43

1 Answer 1

10

Short answer: put /var/run/postgresql in host name/address.

Sign up to request clarification or add additional context in comments.

2 Comments

Still, the best answer, a lot of answers said to add a new password via psql command but I just want it to work without adding a password.
Bravo. How on earth do you know this works?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.