优胜美地升级& Postgres连接问题

时间:2015-01-26 04:01:19

标签: sql ruby-on-rails macos postgresql

ETA:上面可能的答案不回答我的问题。我无法创建这些目录。

在去Apple Store进行维修之后,我的macbook又回来了Yosemite。对于Postgres,我的开发环境工作正常。我用自制软件重新安装,当我键入" psql"进入我的终端我得到了这个:

$ 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"?

我已经尝试过网站上的每一个建议都无济于事。每当我尝试改变任何东西时,我都会被许可拒绝,即使使用SUDO它也不会起作用。

我尝试过的一些事情:

$pg_ctl initdb

结果:

The files belonging to this database system will be owned by user "**********". This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /var/lib/pgsql/data ... initdb: could not create directory "/var/lib/pgsql": Permission denied pg_ctl: database system initialization failed

我尝试过使用Lunchy

$ lunchy start postgres /usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist: File exists started homebrew.mxcl.postgresql

没有工作。

也试过这个:

$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents ‘/Users/**************/Library/LaunchAgents/homebrew.mxcl.postgresql.plist’ -> ‘/usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist’

以及其他一些方法。

Postgres位于此处:/usr/local/bin/postgres在我的计算机上。它应该被移动吗?

有人可以尝试一步一步的说明吗?我觉得我已经尝试了所有的东西而且我在这里真的很茫然,因为它不应该这么困难。谢谢!

1 个答案:

答案 0 :(得分:0)

我在CoderWall的帮助下自己解决了这个问题。我的问题是/ usr / local / var / postgres /

中缺少一些目录

CoderWall提供的单行修复:

mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}

我在我的开头标记了一个sudo,以确保它有效。