Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres DB not starting on Mac OSX: ERROR says: connections on Unix domain socket [closed]

I ve installed Postgresql and then ran a bunch of rails apps on my local Mac OSX Mountain Lion and created databases etc. Today after a while when I launched pgAdminIII and tried to launch a database server I got this error:

enter image description here

A quick google showed this post. More browsing pointed to the fact that there might be some sort of postmaster.pid file lying around that might be the root cause of this. If I delete that things would be fine.

However, before I go deleting stuff on my computer I wanted to make sure Im debugging this in a systematic way which would not result in more problems.

Somewhere I read that before deleting that file, I need to run this command:

  ps auxw | grep post 

If I get no results then, its OK to delete the file. Else not. Well, I got this result of that command:

  AM               476   0.0  0.0  2423356    184 s000  R+    9:28pm   0:00.00 grep post 

So now of course Im throughly confused.

So what should I do?

Here is part of my postgres server error log:

 FATAL:  lock file "postmaster.pid" already exists  HINT:  Is another postmaster (PID 171) running in data directory "/usr/local/var/postgres"? 

Postgresql is still not running, still get the same error and nothing has changed. Im too chicken to delete things without checking on SO.

Could some of you experts please guide a noob.

Thanks

like image 850
banditKing Avatar asked Jul 23 '13 01:07

banditKing


People also ask

Can't connect to Postgres server?

“Could not connect to server: Connection refused” To be sure that PostgreSQL is running, you can also restart it with systemctl restart postgresql. If this does not fix the problem, the most likely cause of this error is that PostgreSQL is not configured to allow TCP/IP connections.

How can I tell if Postgres is running on my Mac?

psql -c "SELECT 1" -d {dbname} > /dev/null || postgres -D /usr/local/var/postgres >postgres. log 2>&1 & if you want to check and start postgres in one go (handy for automation scripts).

Can't connect to server No such file or directory Postgres Mac?

Remove all Postgres folders : rm -r /usr/local/var/postgres. rm -r ~/Library/Application\ Support/Postgres. Reinstall postgresql with brew : brew install postgresql.


1 Answers

I had the same problem today on Mac Sierra. In Mac Sierra you can find postmaster.pid inside /Users/<user_name>/Library/Application Support/Postgres/var-9.6. Delete postmaster.pid and problem will be fixed.

like image 141
r3b00t Avatar answered Sep 30 '22 17:09

r3b00t