0

My Server: CentOS 7 x64, PostgreSQL 11.2

My Client: Navicat, pgAdmin 4.5 . Error at client:

FATAL: no pg_hba.conf entry for host "14.248.254.146", user "postgres", database "postgres", SSL off

I have done many things:

(1) Open firewall port 5432 . Restart firewalld

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT -m comment --comment "PostgreSQL"    
firewall-cmd --permanent --add-port=5432/tcp
firewall-cmd --reload

(2) Edit vi /var/lib/pgsql/11/data/pg_hba.conf

/var/lib/pgsql/11/data/pg_hb.conf

add

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all             0.0.0.0/0               trust

(4) Reload

service postgresql-11.service reload

but not success enter image description here

pgAdmin 4.5 is the same

enter image description here

I don't know what is 14.248.254.146 ??

  • Can you connect using the psql command line client? – Vérace Apr 15 at 10:44
  • I don't try use cmd. At this time, I can connect use Navicat Premium. – Do Nhu Vy Apr 15 at 10:58
  • Are you saying that you can connect using Navicat? – Vérace Apr 15 at 10:58
  • I also use pgAdmin 4.5 for testing connection. – Do Nhu Vy Apr 15 at 10:59
0

14.248.254.146 is my Wifi access point IP.

vi /var/lib/pgsql/11/data/pg_hba.conf

a part of the content

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all             0.0.0.0/0               trust
host    all             postgres        14.248.254.146/32       ident

then

service postgresql-11.service reload

it works

  • 1
    I suggest you keep trust only for local connections and use md5 (or more advanced) for connecting from anywhere else e.g. host all all 0.0.0.0/0 md5). You can add a different role (superuser or not) and use that to connect from any other machine. Use postgres role only for connections from the host itself. – ypercubeᵀᴹ Apr 15 at 6:49
  • thank you for your advice – Do Nhu Vy Apr 15 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.