Connect with psql
and run:
SHOW port;
Betcha the port given isn't 5432
. You're probably also on a mac; it's common for mac users to have some binaries linked to the libpq
supplied by the operating system (an old PostgreSQL) and some to the libpq
of a PostgreSQL they installed themselves. These can have different default socket directories and different TCP port defaults.
You should also:
SHOW listen_addresses ;
and make sure it is *
. If it instead says localhost
then your PostgreSQL isn't listening on external IPs, only the local loopback. In that case, you should change that in the config file. See the introductory PostgreSQL documentation.
If you've confirmed that PostgreSQL is listening on the IP and port of interest, you should make sure you don't have a firewall blocking connections from outside machines. That would usually result in a timeout, not a connection refused error, though.