比较来自世界各地的卖家的域名和 IT 服务价格

Homebrew postgres 扫帚

我已经安装了 Postgresql 9.4.0 在你的 Mac /10.10.1/Yosemite/ 通过 homebrew. 这不起作用。

我创建了一个软链接 /usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist 在 ~/Library/LaunchAgents.

如果我试图手动下载 postgres, 我会收到一条消息 "Operation is in progress"


> launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
/usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist: Operation already in progress


但 postgres, 看起来它不起作用。


> ps auxw | grep post
billmcn 670 0.0 0.0 2424272 452 s000 R+ 10:12PM 0:00.01 grep post


我无法连接到命令行客户端。


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


据我所知,我尝试了所提出的所有修正
https://coderoad.ru/13410686/
线程
https://coderoad.ru/12472988/
, 讨论这个问题。 具体来说:

我删除并重新安装了 postgres 和陪同 Ruby gem. 我的车上没有版本 postgres 8.0.

我检查了客户程序 psql - 这个版本 9.4.0, 安装了 Homebrew, 不是二元系统系统 Mac.

我检查了那个 /usr/local/var/postgres/postmaster.pid 不存在。

我重新启动了这辆车。

在这辆车工作之前 Homebrew postgres. 我认为他从版本中违反了他的更新 8 到版本 9, 但我不确定。

我没有数据库,我需要保存。 我准备开始用纯净的表 postgres; 我现在只需要做它的工作。 有任何想法吗?

问题似乎在目录的权限中组成 /usr/local/var/postgres. 这是我的目录所关注的内容 var, 当一切都没有工作。


ll /usr/local/var/
drwxr-xr-x 3 billmcn admin 102 Dec 20 12:44 cache
drwxr--r-- 2 root admin 68 Dec 29 21:37 postgres


/whoami = "billmcn"/

我删除了 /usr/local/var/postgres, 删除并重新安装 postgres, 现在他看起来像这样。


ll /usr/local/var/
drwxr-xr-x 3 billmcn admin 102 Dec 20 12:44 cache
drwx------ 23 billmcn admin 782 Dec 30 10:51 postgres


我不知道他如何进入这个状态,因为我不记得我对这个目录的权限感到如何感受,但这并不重要。 现在它有效。
已邀请:

石油百科

赞同来自:

我的安装有同样的问题 postgres 通过 homebrew 最近成立 Yosemite.

首先,我的配置 brew 看起来像:


HOMEBREW_VERSION: 0.9.5
ORIGIN: [url=https://github.com/Homebrew/homebrew]https://github.com/Homebrew/homebrew[/url]
HEAD: 9f6926265f8e4be7cc80dfe9042f2cd3c1e8dc9e
Last commit: 64 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.10.1-x86_64
Xcode: 6.1.1
Clang: 6.0 build 600
X11: N/A
System Ruby: 2.0.0-481
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: ~/.rvm/rubies/ruby-2.1.1/bin/ruby


我注意到的第一件事是我没有许可写入
/usr/local/var/postgres

. 它很容易通过释放改变
sudo chown -R `whoami` /usr/local/var/postgres

, 然后我重新安装 postgresql 并做了


cat /usr/local/var/postgres/server.log


显示:


postgres cannot access the server configuration file "/usr/local/var/postgres/postgresql.conf": No such file or directory


所以我删除了目录
/usr/local/var/postgres

并给出命令才能初始化数据库。


initdb -D /usr/local/var/postgres/


似乎做了他的工作, postgres 工作正常。

裸奔

赞同来自:

我有同样的问题。 这里的主要问题是在安装阶段 initdb 将创建具有root所有权的目录,而不是用户 Mac. 要解决这个问题:

开始前创建数据目录
initdb

并设置权限 0700


rm -rf /usr/local/var/postgres # in case this is not your first try
mkdir /usr/local/var/postgres
chmod 0700 /usr/local/var/postgres


然后推出
initdb

, 它将尊重数据目录的权限。


initdb -D /usr/local/var/postgres


对于傻瓜和咯咯笑,创建一个测试数据库,称为您的用户:


createdb `whoami`


登录以测试:


psql

冰洋

赞同来自:

尝试安装后 postgresql 和 Homebrew 我知道了:


Warning: postgresql-9.5.2 already installed, it's just not linked


所以我试过:


brew link postgresql


并收到此错误:


Linking /usr/local/Cellar/postgresql/9.5.2... 
Error: Could not symlink share/man/man3/SPI_connect.3
/usr/local/share/man/man3 is not writable.


看起来这是一个录制许可的问题,所以我这样做:


sudo chown -R `whoami` /usr/local/share/man/


它做了一个伎俩,因为我能做 /没有错误/:


brew link postgresql

石油百科

赞同来自:

请注意他们的线程 Homebrew github 有这个问题的关心:
https://github.com/Homebrew/homebrew/issues/35240
我有一个类似的问题。 詹姆斯的答案帮助我解决了这个问题。 但后来我遇到了一个提到的问题 jbk /删除后 /usr/local/var/postgres 他继续重新创造/.

问题是,如果您已创建符号链接:


ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents


并推出该过程:


launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist


您必须首先卸载它:


launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist


在执行詹姆斯团队之前。


rm -rf /usr/local/var/postgres # in case this is not your first try
mkdir /usr/local/var/postgres
chmod 0700 /usr/local/var/postgres


此外,如果像我一样,你有一个管理员经理 homebrew, 和将使用的通常用户 pgsl 用于发展目的,团队 James 必须作为超级用户执行:


sudo -s


数据库目录的属性 Postgres 必须提供给处女的用户 :


chown my-dev-user /usr/local/var/postgres


下一个命令代表用户执行 dev, 然后应该正确填写目录:


createdb `whoami`


跑步:


psql -l


必须显示您的表和用户权限 postgre 经过这样的操作。

我希望它会有所帮助。

诸葛浮云

赞同来自:

对于后代,我有这个问题,我想注意我为我工作。

我是统治 postgres 11.2 上 High Sierra. 我最近搬了 postgres 10 上
brew postgresql-upgrade-database

.

我继续弄错了
psql: could not connect to server: No such file or directory

, 和我的 server.log 指示
is another postmaster /PID 5894/ running in data directory "/usr/local/var/postgres"?


我尝试了几种解决方案,包括重新启动计算机,删除
postmaster.pid

, 使用
brew services restart postgres

, 但无济于事。 到底,我遇到了决定:


brew unlink postgresql && brew link postgresql


我不知道为什么它有效,但我主要把它置于这里,以便我将来可以提及自己! 在所有垃圾的墙壁上推动,直到她伸出来!

涵秋

赞同来自:

如果有人使用以前的版本,请不要忘记:


brew postgresql-upgrade-database


这将通过将现有数据库更新为您更新的版本来解决问题 postgres.

董宝中

赞同来自:

退房 @leo_chaz_maltrait 纠正错误错误
Could not symlink share/man/man3/SPI_connect.3

可能出现的另一个错误:


Error: Could not symlink lib/pkgconfig/libecpg.pc



sudo chown -R `whoami` /usr/local/lib/pkgconfig

brew link postgresql

八刀丁二

赞同来自:

我最近在我更新一些更新时开始了一个问题 / 更新 brew, 基本版本 python 等等。对我有什么用。


brew uninstall postgres
brew install postgresql@9.5
echo 'export PATH="/usr/local/opt/postgresql@9.5/bin:$PATH"' > ~/.zshrc
# you may need > ~/.bashrc if you use bash


我不得不 pg_dump, pg_restore 等等,为了使它工作,我做到了


brew install libpq


运行服务


brew services start postgresql@9.5


从这里,我希望大家工作,但仍然是所有的团队 rails db 发出错误服务器不起作用的错误。 最后一件是谜题的缺失部分,最终为我决定了它。


gem uninstall pg
gem install pg -v 0.20.0 # which was set in Gemfile
# could also just probably do bundle install instead.

要回复问题请先登录注册