相关疑难解决方法(0)

PostgreSQL错误'无法连接到服务器:没有这样的文件或目录'

像其他一些人一样,当我在我的项目中运行rake db:migrate或者甚至为我的Ruby on Rails 3.2应用程序尝试大多数数据库任务时,我收到此错误.

PGError(无法连接到服务器:没有这样的文件或目录.服务器是否在本地运行并接受Unix域套接字上的连接"/tmp/.s.PGSQL.5432"?

很久以前我用Homebrew安装了PostgreSQL,并且在最近尝试安装MongoDB后,我的PostgreSQL安装从未如此.我正在运行OS X v10.6 Snow Leopard.

出了什么问题,我怎么能更好地理解PostgreSQL是如何设置在我的Mac上的呢?

到目前为止(我认为)这告诉我PostgreSQL没有运行(?).

ps -aef|grep postgres                                                                                                   (ruby-1.9.2-p320@jct-ana) (develop) ?
  501 17604 11329   0   0:00.00 ttys001    0:00.00 grep postgres
Run Code Online (Sandbox Code Playgroud)

但这是否告诉我PostgreSQL正在运行?

? launchctl load -w /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist                                                        (ruby-1.9.2-p136) 
homebrew.mxcl.postgresql: Already loaded
Run Code Online (Sandbox Code Playgroud)

我该如何解决?我没看到什么?

PS:~/Library/LaunchAgents包含两个PostgreSQL .plist文件.我不确定这是否相关.

org.postgresql.postgres.plist
homebrew.mxcl.postgresql.plist
Run Code Online (Sandbox Code Playgroud)

我尝试了下面的结果,得到了如下结果.

$ psql -p 5432 -h localhost

psql: could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on …
Run Code Online (Sandbox Code Playgroud)

postgresql homebrew osx-snow-leopard

134
推荐指数
9
解决办法
21万
查看次数

Postgres在Docker上.如何创建数据库和用户?

我正在尝试使用docker创建简单的postgres服务器.我使用官方的postgres图像作为我的容器的基础.我的Dockerfile包含以下命令:

FROM postgres
USER postgres
RUN /etc/init.d/postgresql start &&\
    psql --command "CREATE USER user WITH SUPERUSER PASSWORD 'user';" &&\
    createdb -O user app
Run Code Online (Sandbox Code Playgroud)

当我尝试运行它时,我有一个错误:

psql:无法连接到服务器:没有这样的文件或目录服务器是否在本地运行并接受Unix域套接字"/var/run/postgresql/.s.PGSQL.5432"上的连接?

我做错了什么?

postgresql docker

5
推荐指数
1
解决办法
3575
查看次数

标签 统计

postgresql ×2

docker ×1

homebrew ×1

osx-snow-leopard ×1