- Southampton, England
Configure PostgreSQL to accept TCP/IP connections
Stack: MacPorts PostgreSQL 9.x on OS X 10.6 (Snow Leopard)
After switching to a new Mac, I didn't have time to reinstall and setup PostgreSQL. I decided to access PostgreSQL on my old machine over the network. When I tried to connect, I hit the following error:
Well, it was running but obviously not accepting connections. Let's change that.
Get some superuser privileges and find the location of pg_hba.conf (Client Authentication Configuration File)
Change directory to where it's located and edit:
Add the following line where x.x.x.x is the ip address of the client machine:
Now edit postgresql.conf (PostgreSQL configuration) that's located in the same directory.
Wildcard the listen address:
Restart PostgreSQL and try connecting again from the client machine.