Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Unable to connect to PostGreSQL database on Ubuntu server
Having a time trying to connect to a PostGreSQL database on Ubuntu 18.04 server.
Here is my:
postgresql.conf file :
host all all 0.0.0.0/0 md5
firewall is currently disabled
here is the output when I did the command (saw in another thread to do this…):
sudo netstat -ltpnActive Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 608/systemd-resolve tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 842/sshd tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 2922/postgres tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1055/master tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 867/nginx: master p tcp6 0 0 :::22 :::* LISTEN 842/sshd tcp6 0 0 :::25 :::* LISTEN 1055/master tcp6 0 0 :::80 :::* LISTEN
I have restarted postgresql each time using the command ‘sudo service postgresql restart’.
I have tried to access the db using the python library psycopg2 on macOS and getting this error
could not connect to server: Connection refused Is the server running on host "<ip_address>" and accepting TCP/IP connections on port 5432?
What am I missing?
Thanks in advance!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×