0

I'm trying to connect to my RDS database via rails console but seem to be hitting the following issue:

/gems/pg-0.20.0/lib/pg.rb:56:in `initialize': FATAL: no pg_hba.conf entry for host "94.xx.xxx.xx", user "DATABASE_NAME", database USERNAME, SSL off (PG::ConnectionBad)

I've come across a handful of similar questions surrounding this such as:

My pg_hba.conf currently looks like:

  # TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
local   all             all                                     md5
hostnossl    all          all            0.0.0.0/0  trust
host  <DB_NAME> <USERNAME>     94.XXX.XXX.XXX/32       trust

I've tried also tried adding the following line to my pg_hba.conf stopped and started the postgres service and still i'm still running into the same issue.

hostnossl all all 0.0.0.0/0 trust

I also have the following in my postgresql.conf

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -
listen_addresses = '*'

I've ran out of ideas on what I could be missing

green1919
  • 289
  • 2
  • 13
  • Can you access to your database with the same credentials directly with psql? – Abdel P. Jun 28 '20 at 01:51
  • you do have real user name and db name in pg_hba.conf, right? I can't tell if you put in the file or if you're just hiding the real value from us! The values in pg_hba.conf should match the values in your rails config/database.yml file. – Les Nightingill Jun 28 '20 at 19:17

0 Answers0