Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connecting to PostgreSQL over a network

I have a pgsql server running on windows 7. I can remotely connect to it within the network using the computer name, so i know that there are no issues with config etc. I have disabled firewall. I have a static ip and have tried to connect to the database from another network but i get the error: server does not listen. What am i doing wrong? I know small amounts about ip addresses so any help will be appreciated. thanks in advance!

EDIT: A little more information, i have set up a home network, i have two computers networked together that can both access the pgsql server that resides on one of the computers. I am based in the uk and get my internet from plusnet, config is all done on the thompson gateway. The third computer is a remote computer not on the same network, i was just testing to see whether or not i could "host" a pgsql database for several, not networked computers. Its more of a hobbiest thing really, although would be could if i could do it for work reasons too. Thanks for you help. (sorry if i sound dumb but this really isnt my subject-yet!)

like image 541
Daniel Casserly Avatar asked Jan 18 '11 22:01

Daniel Casserly


1 Answers

Configure the pg_hba.conf file to add the line

host all all 192.168.0.1/24 trust

that IP 192.168.0.1 is just for the sake of example, you'll put there your IP then edit the postgresql.conf to reflect these settings

tcpip_socket = true 

i think this ^^ is only required for older versions, but add it there anyway

listen_addresses='*'

by default it's localhost, put * to listen to all addresses, or just your IP to tighten up the security

like image 172
Ilya Saunkin Avatar answered Dec 10 '22 10:12

Ilya Saunkin