I am running MacOS 10.14.1 (absolutely new to MacOS), I am unable to run psql
command installed through brew
, I get the following error, would love some help:
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"?
Solutions I have tried
brew services start
service already running brew services stop postgresql, brew services start postgresql
still same error brew remove postgres, brew install postgres, psql
still same error brew unlink postgresql && brew link postgresql
still same error rm -f /usr/local/var/postgres/postmaster.pid
my /usr/local/var/
does not contain a postgres/
folder One more thing to note, when I brew install postgres
I get a warning:
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall postgresql`
running brew postinstall postgresql
gives the same warning.
Hopefully provided enough information to go by, happy to provide more.
The reason for this is that the process is running but the postmaster.pid
file is missing from /usr/local/var/postgres/
, so you need to start the process for Postgres
which creates postmaster.pid
.
If the process is already running,
Stop it manually using the command below:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
Start it manually using the command below:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
now all should be working just fine.
尝试这个
initdb /usr/local/var/postgres
I just hit this with an existing brew install of 12.1.
brew uninstall postgresql
brew install postgresql
This fixed it. Also took me from 12.1 to 12.3.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.