16

I am following the step by step instructions from this link https://www.postgresqltutorial.com/connect-to-postgresql-database/ here to create a simple server on pgadmin. Please check the picture enter image description here

What am I doing wrong, I installed pgadmin on my macOS but I don't see why I am getting this error. Please help

Mystery Man
  • 535
  • 2
  • 7
  • 20

7 Answers7

6

It's an issue with AWS inbound rules not pgAdmin. Follow this guide to solve it. It works.

Roy Thande
  • 98
  • 2
  • 9
4

In the file pg_hba.conf you have to change:

host    all             all             <your_ip/mask>          ident

to:

host    all             all             <your_ip/mask>          md5

<your_ip/mask> is your ip address where you are connecting from. For example 10.1.1.5/32.

You have to add one if it doesn't exist yet.

I'm using CentOS so the file pg_hba.conf is located in /var/lib/pgsql/data for me. If you don't know where the file is located on your OS you can use the search to find the file.

Oleg
  • 43
  • 1
  • 6
  • While I tried to open the file. It says "Could not open the file ....... You don't have the permission to open this file" – Rubel Jul 04 '21 at 11:26
  • Check if you logged in with the same user as the owner of the file. If these are different users check what permissions for "other users" are configured on this file. On Linux, you can check it with `ls -l` command. – Oleg Jul 05 '21 at 12:20
  • but when the IP I am connecting from changes, I always have to change it in the pg_hba.conf right? thats highly unpractical for me... – Pfinnn Jul 01 '22 at 14:00
4

What worked for me is before saving go to advanced tab and in connection timeout give 100 or any bigger number and then save.

Vishesh Mishra
  • 988
  • 9
  • 12
2
  • Go to "Security group rules" (under "Connectivity & security")
  • Click the item "default" Security group
  • Click "Actions" > "Edit inbound rules" > "Add rule"
  • Select... Type: "All traffic", Source: "My IP", then click "Save rules"
2

Same issue for me with a brand new Debian 10 installation.

pg_hba.conf


#IPv4 local connections:
host    all             all             all          md5

#IPv6 local connections:
host    all             all             all          md5


postgresql.conf

listen_addresses = '*'

I restart postgresql service after with sudo service postgresql restart. Status is active and when I run

netstat -nlp | grep 5432

I get

tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      1071/postgres
tcp6       0      0 :::5432                 :::*                    LISTEN      1071/postgres

In this example I add all hosts, I know it's not a secure way, but it's still a test, I will filter by Ip adresses after.

Is there a particular configuration with nftables firewall to set up ?

GeoGyro
  • 487
  • 12
  • 32
0

First make sure, your AWS RDS instance is set to be publicly accessible.

If the error persists, check these two things. Make sure the Route Table attached to your public subnet:

  • has been set as main route table. To do this: go to VPC dashboard in AWS console >> Select "Route tables" option from the left link >> Select your route table >> From the "Actions" button click on "Set main route table" from the dropdown menu

  • has the route for the Internet Gateway that you're using in your VPC. You can check this on the "Routes" tab in the lower pane of your route table.

A K
  • 31
  • 4
0

You may need to pass the port from the firewall

try that:

 sudo ufw allow 5432/tcp
Zaid Qassim
  • 109
  • 1
  • 5