我最近更新了我的机器(运行Mountain Lion的MacBook Pro),从那时起,每当我设置一个rails项目时,我的机器就会崩溃,无法连接到PG.目前,这是我尝试去localhost时遇到的错误;
PG :: ERROR无法连接到服务器:连接被拒绝服务器是否在主机"localhost"
(:: 1)上运行并接受端口5432上的TCP/IP连接?无法连接到服务器:连接被
拒绝服务器是否在主机"localhost"(127.0.0.1)上运行并接受端口5432上的TCP/IP连接?无法连接到服务器:连接被拒绝服务器是否在主机"localhost"(fe80 :: 1)上运行并接受端口5432上的TCP/IP连接?
这是一份清单,以及我尝试的事项清单;
PostgreSQL版本是9.3.4
我通过HomeBrew安装它
我有host: localhost
我的database.yml文件
Rails版本4.1.1,ruby 2.0.0p247(2013-06-27修订版41674)[x86_64-darwin12.5.0]
brew uninstall postgresql
然后跑brew install postgresql
试图访问我的postgres.conf文件,但不允许通过PGAdmin和命令行
Ran locate pg_hba.conf
和终端出局了;
WARNING: The locate database (/var/db/locate.database) does not exist.
我也尝试过使用rails 4.0,但我仍然遇到了问题
在我更新计算机之前,我仍然可以在我的机器上处理启动/完成的其他项目.
当我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"?
我真的迷失在这里,不知道还能做什么.任何帮助将非常感激.
更新:
感谢这个问题,只需下载Postgres.app for Mac 即可解决所有问题.现在一切都很好.
这比你想象的要容易得多,因为如果你更新你的mac,那么进程正在运行但是postmaster.pid
文件从/usr/local/var/postgres/
这里丢失了.所以你需要为postgres启动创建postmaster.pid的进程.
如果进展正在运行 -
手动停止:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
手动启动:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
现在一切正在......