PostgreSQL pg_hba.conf Error

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
PostgreSQL pg_hba.conf Error

PostgreSQL pg_hba.conf Error

Error:
psql: FATAL:PostgreSQL pg_hba.conf Error
no pg_hba.conf entry for host “192.168.0.11”, user “webuser”, database “webapp”, SSL off
Step 1: Locate pg_hba.conf

It’s usually in:

  • /var/lib/pgsql/<version>/data/pg_hba.conf (RHEL/CentOS)

Check it with:

psql -U postgres -c "SHOW hba_file;"
Step 2: Add an entry for the client

Open the file and add a line

# Allow connections from 192.168.0.11
host webapp webuser 192.168.0.11/32 md5
Step 3: Reload PostgreSQL

Apply changes without restart:

sudo systemctl reload postgresql-15
Step 4: Ensure user has a password

Log in as postgres and set a password for webuser:

sudo -i -u postgres psql
ALTER USER webuser WITH PASSWORD 'your_secure_password';

Conclusion

Tuning PostgreSQL for peak performance is a journey, but with a clear understanding of these configuration parameters, you’re well on your way to becoming a pro! At Learnomate Technologies, we’re here to support you every step of the way with top-notch training in PostgreSQL DBA and more.

For more detailed insights and tutorials, do check out our YouTube channelwww.youtube.com/@learnomate, where we regularly share practical tips and deep dives into essential database topics. And if you’re serious about mastering PostgreSQL DBA, head over to our website for our full training program: learnomate.org/training/postgresql-training/.

I’d love to connect with you, so don’t forget to follow my LinkedInhttps://www.linkedin.com/in/ankushthavali/. If you’re eager to read more about various technologies, explore our blog page here: https://learnomate.org/blogs/. Happy learning, and remember—tuning and training go hand-in-hand for database success!