0

I have no idea how to configure that pg_hba.conf file, to connect with my server via pgAdmin. Right now i was trying to add:

host all all host.name.org.pl trust

host all all host.name.org.pl md5

host user_name database_name ip_adress trust

host all all ip_adress trust/md5

and others..

I've got a postgresql server. My provider says that i must connect by adress: sql.user_name.org.pl and 5432 port. There is no ssl on the server. I've got user and password. Can somebody please help me, to deal with this?

3
  • 1
    You forgot to mention essential data: is pgAdmin residing on the same machine? Connecting via TCP/IP or Unix-domain socket? If you are connecting to a remote server, are you editing the right pg_hba.conf file? Reloading the server afterwards? Either way, the server log file normally has detailed messages, why a connection attempt was denied. If nothing's there, you didn't even reach the right Postgres instance. And read the manual before tampering with pg_hba.conf. Jan 11, 2013 at 20:18
  • I am trying to connect to remote server on other machine. Yes i am trying to edit pg_hba.conf file. I dont know how to reload the server. I got a message why connection was denied, it says that there is no proper pg_hba.conf entry for that connection. Thats why I am asking how to do it correct. Jan 11, 2013 at 20:22
  • 1
    Remote server -> remote pg_hba.conf file! You got that, right? On Debian derivates, you can reload the server with pg_ctlcluster <pg_version> <cluster_name> reload. Basic tool: pg_ctl - read the manual where I linked to. But you need to run this as the system user that runs the server, usually postgres. If this is a remote provider, I doubt you have the rights, and your provider will know how to get this done. Jan 11, 2013 at 20:30

1 Answer 1

1

If you have to connect via TCP/IP using IPv4, i.e., the most common situation, you should check what is your IP address. Ince you have it, add this line to pg_hba.conf file on the server. This line should be added after all lines that start with local and before other lines that start with host:

host databasename username ipaddress/32 md5

if youo don't know your ip address, or if it is variable (for a dialup line), then use 0.0.0.0/0 instead of ipaddress/32. This way you will allow connection from any IP address.

But, if your provider is responsible for postgresql, then he should make thee changes. Are you sure you need to configure that file on the server?

If you are only responsible for your client machine, and you want to connect via pgAdminIII, then just use the hostname portnumber username and password provided by your provider. If you cannot connect using these settings, please come back here and write what is the exact error you get from pgAdminIII.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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