Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Remote connect to Postgresql ML server

I'm getting the following error when I try to connect to Postgresql 9.2.4 on my server 2.2.1 on my local network:


could not connect to server: Connection refused


Can connect on Mac running server ok.


How do I over come this error.


PS: don't like to use Terminal😕 but will if I have to.

MAC MINI SERVER (LATE 2012), OS X Mountain Lion (10.8.4)

Posted on Sep 9, 2013 8:54 AM

Reply
15 replies

Sep 9, 2013 1:51 PM in response to jimasmith

See the section headed "Additional Information" in this support article.

By default, the server doesn't listen on the network. To change that behavior, edit the file


/Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist

To the line that begins

<string>listen_addresses=


add a comma-separated list of addresses on which you want it to listen. Then restart the server:


sudo serveradmin stop postgres
sudo serveradmin start postgres

Sep 9, 2013 2:52 PM in response to Linc Davis

I stop and restarted the server, the log shows:


Sep 9 17:45:39 www com.apple.launchd[1] (org.postgresql.postgres[3187]): Exited with code: 1

Sep 9 17:45:39 www com.apple.launchd[1] (org.postgresql.postgres): Throttling respawn: Will start in 10 seconds

Sep 9 17:45:49 www com.apple.launchd[1] (org.postgresql.postgres[3225]): Exited with code: 1

Sep 9 17:45:49 www com.apple.launchd[1] (org.postgresql.postgres): Throttling respawn: Will start in 10 seconds

Sep 9 17:46:00 www com.apple.launchd[1] (org.postgresql.postgres[3266]): Exited with code: 1

Sep 9 17:46:00 www com.apple.launchd[1] (org.postgresql.postgres): Throttling respawn: Will start in 10 seconds


this happen repeatly.


Also another question. I had a very dificult time of changing the file, protected, even after changing the premissions. Is there an easy way?

Sep 10, 2013 8:09 AM in response to jimasmith

I think I have the crashing probllem fixed, what ever that was.


I have changed /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist

to


listen_addresses=127.0.0.1,192.168.1.126


The 192.168.1.126 is the ip address of mac I'm trying to connect with.


I'm getting following error:

Error connecting to PostgreSQL: could not connect to server: Operation timed out

Is the server running on host "192.168.1.131" and accepting

TCP/IP connections on port 5433?


Note: I'm using port 5433, that happen when I installed Postgresql.


The app I using work ok when ran on same mac as server (using 127.0.0.1)

Sep 10, 2013 1:06 PM in response to Linc Davis

OK have change the plist, it look like this:


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>ProgramArguments</key>

<array>

<string>-D</string>

<string>/Library/Server/PostgreSQL/Data</string>

<string>-c</string>

<string>listen_addresses=127.0.0.1,192.168.1.131</string>

<string>-c</string>

<string>log_connections=on</string>

<string>-c</string>

<string>log_directory=/Library/Logs/PostgreSQL</string>

<string>-c</string>

<string>log_filename=PostgreSQL.log</string>

<string>-c</string>

<string>log_line_prefix=%t </string>

<string>-c</string>

<string>log_lock_waits=on</string>

<string>-c</string>

<string>log_statement=ddl</string>

<string>-c</string>

<string>logging_collector=on</string>

<string>-c</string>

<string>unix_socket_directory=/private/var/pgsql_socket</string>

<string>-c</string>

<string>unix_socket_group=_postgres</string>

<string>-c</string>

<string>unix_socket_permissions=0770</string>

</array>

</dict>

</plist>



My server Network settings

User uploaded file



Still not getting connected.


Is there any log that I can look at that may indicate problem?

Sep 10, 2013 1:40 PM in response to Linc Davis

I did not change the port. I install Postgresql twice. The first time it gave port 5432. When I reinstalled it gave me 5433, did not have option to change it. That may be the problem.


I was just doing a little test with the browser, when enter url "192.168.1.131:80" it was connected very fast.

I then tried "192.168.1.131:5432" and it gave me error message very fast.

Then tried "192.168.1.131:5433" and it took long time to give error message.


It me it looks as the 5433 is getting to the server and trying to do something.


Think I should change the port? If so how?


OH! and I think the easy way to do thing is use the terminal.

Sep 10, 2013 4:22 PM in response to Linc Davis

I don't know. I think I read if you were starting with a new server it was best to install PortgreSQL 9.2.4. So that what I did. I have also re-installed the ML server, I got the Mac Mini with server pre-installed. This is the first time I have used the Apple Support Commuities. Maybe I should have come here sooner. I don't have much on my server yet, just one table under development. And some php table update stuff.


Should I start all over and use the built in PostgreSQL?

Sep 11, 2013 12:27 PM in response to Linc Davis

I have restored my system/server back to before installing the second PostgreSQL.

Have installed phpPgAdmin.

Before I got rid on the old stuff I Exported the 2 tables I had already set up, so I can rebuild them.

Also have other stuff copied back and able to sign on to pages I had previous.


Now what do I need to do to get signed on to PostgreSql, so I can create tables?

Remote connect to Postgresql ML server

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.