2014-06-18 57 views
0

我用brew来安装postgresql,并且还用它来安装pg Gem。然而,当我尝试运行CREATEUSER数据库名称我得到这个错误:用postgresql创建用户致命错误

createuser: could not connect to database postgres: FATAL: could not open relation mapping file "global/pg_filenode.map": No such file or directory 

我已经试过完全从酿造,宝石和在/ usr /本地的/ var/Postgres的文件卸载,仍然在我不工作做一个重新安装(奇怪的是,当我做一个重新安装并尝试initdb,它说该文件不是空的?)

谷歌搜索和我找到了一些解决方案,但我不知道如何做他们

  1. 删除并重新添加启动代理
  2. 杀死流程,9.0.3
  3. 初始化数据库initdb的在/ usr /本地的/ var/Postgres的
  4. 重新启动计算机

最后2个指令是非常简单的,但我不知道如何做前2

有什么建议吗?

回答

1

我想象您在Postgres is failing with 'could not open relation mapping file “global/pg_filenode.map” '来澄清前两个步骤:

$ launchctl stop homebrew.mxcl.postgresql 
$ killall postgres 
$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist 
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist 

在为Postgres公式警告有更多的信息,您可以用brew info postgres查看:

==> Caveats 
If builds of PostgreSQL 9 are failing and you have version 8.x installed, 
you may need to remove the previous version first. See: 
    https://github.com/Homebrew/homebrew/issues/issue/2510 

To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see: 
    http://www.postgresql.org/docs/9.3/static/upgrading.html 

When installing the postgres gem, including ARCHFLAGS is recommended: 
    ARCHFLAGS="-arch x86_64" gem install pg 

To install gems without sudo, see the Homebrew wiki. 

To reload postgresql after an upgrade: 
    launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist 
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist