重启我的Mac后,我遇到了可怕的Postgres错误:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)
发生这种情况的原因是因为我的macbook完全因为一个无关的问题而冻结,我不得不使用电源按钮进行硬重启.重新启动后,由于此错误,我无法启动Postgres.
像其他一些人一样,当我在我的项目中运行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) 在此之前,请注意我在Stack Overflow和网络上的文章中发现了几个类似的问题,但这些都没有帮助我解决我的问题:
现在,问题在于:
master和一个mvp分支机构.git用Homebrew(Mac)更新了我的版本.现在,当我尝试在本地启动应用程序时,出现以下错误:
PG::ConnectionBad at /
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?
Run Code Online (Sandbox Code Playgroud)
我试图多次重启计算机.
我还检查了以下内容/usr/local/var/postgres:
PG_VERSION pg_dynshmem pg_multixact pg_snapshots pg_tblspc postgresql.conf
base …Run Code Online (Sandbox Code Playgroud) ruby postgresql ruby-on-rails ruby-on-rails-3 ruby-on-rails-4