1.6 KiB
layout | status | published | title | author | author_login | author_email | wordpress_id | wordpress_url | date | date_gmt | categories | tags |
---|---|---|---|---|---|---|---|---|---|---|---|---|
post | publish | true | psql could not connect to server | [{display_name sipp11} {login sipp11} {email sipp11@gmail.com} {url }] | sipp11 | sipp11@gmail.com | 978 | http://blog.10ninox.com/?p=978 | 2014-04-13 02:54:27 +0700 | 2014-04-12 19:54:27 +0700 | [osx] | [error] |
There are a few problems when you think of Homebrew on OSX. This is a problem that has nothing to do with Brew at all.
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
When you find this error message while getting back from system crash, freeze, or any unexpected shutdown, it only means that there is a dirty PID file pointing out the somewhere empty. Basically every daemons will create .pid to store process number, socket and such, so when need, it will be able to do it right and delete right after shutting down the daemons. However, when unexpected shutdown occurs, no time for cleaning up .pid file, that's where problems start. Everyone will think that the daemon is running (its .pid file exists) and asking for something, surely that .pid file can only lead to false route.
Solution:
you do clean up for system. In this case, Brew's PostgreSQL .pid file is at /usr/local/var/postgres/postmaster.pid
$ sudo rm /usr/local/var/postgres/postmaster.pid
Then you can start your postgres again. It's the same with every other daemons; you just need to find its PID file.