Whenever my Macbook runs out of battery, my Postgresql database is stuck in a weird state and I get this message when launching
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"?
Very simple, just run this in your terminal. You should be good to go!
My associate always has that but when I run this command I get
no such file or directory :/
kind of running into this issue as well.
similar to this: http://stackoverflow.com/questions/34797997/initdb-usr-local-var-postgres-on-el-capitan
tried initdb with
$ sudo ,
$ sudo -u username but always get
initdb: could not change permissions of directory "/usr/local/var/postgres": Operation not permitted
Any idea? Thanks!
I bet you upgraded to El Capitan. Then your Homebrew permissinons have been screwed up. You should run this:
sudo chown -R `whoami` /usr/local
Après la mis à jour mac os sierra, j'ai du faire cela :
Try running postgres -D /usr/local/var/postgres -- it will give you a much more verbose output if postgres fails to start.
In my case, running rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8 removed my old databases and then reinitialized the postgres db schema.
source : http://stackoverflow.com/questions/13410686/postgres-could-not-connect-to-server
perfect, still works! thanks
Hi, I had the same error and none of the answers fixed it. However, following this guide fixed the problem entirely: https://medium.com/@bitadj/completely-uninstall-and-reinstall-psql-on-osx-551390904b86