PostgreSQL服务器的本地机器,但PSQL上运行无法连接
问题描述:
做brew install postgres
后:PostgreSQL服务器的本地机器,但PSQL上运行无法连接
brew install postgres
brew link --overwrite postgresql
的Postgres已经运行:
/~ $brew services start postgresql
Service `postgresql` already started, use `brew services restart postgresql` to restart.
但后来我们如何连接使用psql
客户端?
13:47:28/~ $psql
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"?
更新尝试过各种建议。
尝试重新启动..
$brew services start postgresql
Service `postgresql` already started, use `brew services restart postgresql` to restart.
14:37:19/fastparquet $brew services restart postgresql
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)
14:37:39/fastparquet $psql
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"?
14:37:55/fastparquet $
连接到本地主机?
14:37:34/fastparquet $psql -h localhost
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
答
从a_horse_with_no_name
的链接做了伎俩。具体做法是:
initdb -D /usr/local/var/postgres/
然后
createdb
是否'PSQL -h localhost'工作? –
另请参阅:https://stackoverflow.com/q/27700596/330315或https://stackoverflow.com/a/17411832/330315如果您确实**确实Postgres确实在运行 –
Postgres显然不是运行 –