patternsqlCritical
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host
Viewed 0 times
postgresqlconfentryconnectpg_hbafatalhostforserver
Problem
I am trying to run a website sent to me but after doing so this error appeared
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "4X.XXX.XX.XXX", user "userXXX", database "dbXXX", SSL off in C:\xampp\htdocs\xmastool\index.php on line 37
I found this answer that says that I just need to add an entry in the
This is my
but after doing so, the error still persists. I restarted my XAMPP server several times but nothing changes.
What do I need to change in
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "4X.XXX.XX.XXX", user "userXXX", database "dbXXX", SSL off in C:\xampp\htdocs\xmastool\index.php on line 37
I found this answer that says that I just need to add an entry in the
pg_hba.conf file for that particular user.This is my
pg_hba.conf file.# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
local dbXXX userXXX md5
host dbXXX userXXX XX.XXX.XXX.XXX md5
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5but after doing so, the error still persists. I restarted my XAMPP server several times but nothing changes.
What do I need to change in
pg_hba.conf?Solution
Add or edit the following line in your
Add the following line as the first line of
Restart Postgresql after adding this with
Edit: The authentication method was updated from
postgresql.conf :listen_addresses = '*'Add the following line as the first line of
pg_hba.conf. It allows access to all databases for all users with an encrypted password:# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 0.0.0.0/0 scram-sha-256Restart Postgresql after adding this with
service postgresql restart or the equivalent command for your setup. For brew, brew services restart postgresqlEdit: The authentication method was updated from
md5 to scram-sha-256 because "the MD5 hash algorithm is nowadays no longer considered secure against determined attacks." Please note that scram-sha-256 "is the most secure of the currently provided methods, but it is not supported by older client libraries." Source: official documentationCode Snippets
listen_addresses = '*'# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 0.0.0.0/0 scram-sha-256Context
StackExchange Database Administrators Q#83984, answer score: 439
Revisions (0)
No revisions yet.