Issue connecting to postgres on localhost
See original GitHub issueI’m trying to connect my lambda to a local instance of postgres. However, I’m getting the following error. I found this suggestion but that didn’t work either. Any suggestions? Thanks in advance.
{ Error: connect ECONNREFUSED 127.0.0.1:5432
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432 }```
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
postgres: localhost not connecting - Stack Overflow
In pg_hba.conf: host all all 127.0.0.1/32 trust. last column change to trust.
Read more >PostgreSQL is running locally but I cannot connect. Why?
Try: psql -U rails -d myapp_development -h localhost.
Read more >PostgreSQL psql: could not connect to server - nixCraft
Step # 1: Allow remote IP address to access PostgreSQL. You need to open file called /var/lib/pgsql/data/pg_hba. · Step # 2: Allow communication ......
Read more >Postico User Guide - Connecting to a local PostgreSQL server
This error message usually appears when there is a problem with the /etc/hosts file. Make sure there is an entry for localhost. As...
Read more >PostgreSQL “Could not connect to server” Error - IONOS
The PostgreSQL error “Could not connect to server: No such file or directory” usually means that PostgreSQL is not running.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I resolved this issue by replacing
localhost
withhost.docker.internal
.Reference: https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds
@pawsong try this:
Works for me after few reloads…