0

I installed Ubuntu 14.04 on Azure recently. Have been trying to connect to PostgreSQL but the server refuses the connection. I checked and confirmed that it was online. I also tried changing the settings to trust on pg_hba.conf and I also edited the Postgresql.conf file to listen to all addresses. Furthermore, I checked my firewall settings on Windows and allowed Pgadmin 4 to go through. Despite following all the instructions in this question (Unable to connect PostgreSQL to remote database using pgAdmin), I was unable to connect. What should I do?

1
  • I'm guessing that postgres server is installed on Ubuntu system and you are trying to connect it from your local system using pgAdmin4? Commented Jun 2, 2017 at 8:24

2 Answers 2

2

I once had such issue with pgAdmin4 on win 10. Here is the step I took to connect to my remote server

first enable port 5432 to pass through firewall in ubuntu:

sudo ufw allow 5432/tcp

Then edit your postgresql.conf file and add

listen_addresses = "*"

file can be found at /etc/postgresql//main/postgresql.conf

Proceed to edit pg_hba.conf and add

host   all   all  0.0.0.0/0   md5

Now stop the server using/etc/init.d/postgresql stop and restart /etc/init.d/postgresql start

You should be able to connect now. However, you can allow pgAdmin4 to pass through the windows firewall

control panel > System and Security > Allow an app through windows firewall

You can also allow same app for any antivirus you've installed

Note: If you still cannot connect, you can reset your postgres user's password NOT linux default user

sudo -u postgres psql postgres
# \password postgres
Enter new password

Then use this new password to connect your pgAdmin4 using

  • postgres as Maintenance database

  • postgres as username

  • then new password

Hopefully, you should be able to connect

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

Comments

0

Enable your postgresql server to start at boot

sudo systemctl enable postgresql

Start your postgresql server

sudo systemctl start postgresql

verify your postgresql server is running:

sudo systemctl status postgresql

2 Comments

Are there any commands for 14.04? These are Systemd commands and I am on Upstart.
Never mind. i got to check the status through other commands. The server is running. It is online.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.