postgres server running in local host, but postico, pgadmin can't access to it

1.2k views Asked by At

I successfully installed postgres through homebrew, and i set it run automatically by doing

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

So, right now i can access to psql from my terminal (i use iterm2 + oh my zsh)

psql (9.6.1)
Type "help" for help.

ty2kim=#

The problem is, postgres management tools like postico, pgadmin cannot access to it

for postico, error message is

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5435?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5435?

which is weird because from my understanding, accessing to the database from terminal and management tools are basically the same if configured correctly

My pg_hba.conf and postgresql.conf are set as default (didn't make any changes there), but i tried doing

listen_addresses = 'localhost'  
=>
listen_addresses = '*'
(restart server)

still didn't work

Please help!

2

There are 2 answers

0
Dmitry Umarov On

Port 5435 is not standard for PostgreSQL. Are you sure PG is running on it? If you didn't change it in postgresql.conf it must be 5432. Please check it.

1
Iris On
  1. must check pg_hba.conf. If there doesn't have much restriction, you can put to end of this file by below line: host all all all trust

After that, reload/restart instance.

  1. Check if your PC is using firewall. If yes, please turn off it.