首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Postgresql server在本地计算机上运行,但psql无法连接。

Postgresql server在本地计算机上运行,但psql无法连接。
EN

Stack Overflow用户
提问于 2017-06-20 20:51:37
回答 1查看 3.5K关注 0票数 4

在执行brew install postgres之后:

代码语言:javascript
复制
brew install postgres
brew link --overwrite postgresql

Postgres已经在运行:

代码语言:javascript
复制
/~ $brew services start postgresql
Service `postgresql` already started, use `brew services restart postgresql` to restart.

但是,我们如何使用psql客户机进行连接呢?

代码语言:javascript
复制
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"?

更新尝试了各种建议。

试着重新开始.。

代码语言:javascript
复制
 $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 $

连接到本地主机?

代码语言:javascript
复制
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?
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-06-22 18:11:45

a_horse_with_no_name的链接起了作用。具体地说:

代码语言:javascript
复制
initdb -D /usr/local/var/postgres/

(来自Homebrew postgres broken )

然后

代码语言:javascript
复制
 createdb 

(后者来自" does not exist )

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44662790

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档