使用postgresql FATAL错误创建用户

时间:2014-06-18 22:06:05

标签: ruby-on-rails ruby postgresql

我用brew来安装postgresql,并且还用它来安装pg Gem。但是,当我尝试运行createuser databasename时,我收到此错误:

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

我尝试从brew,gem和/ usr / local / var / postgres文件中完全卸载,但在重新安装后仍然无法正常工作(奇怪的是,当我重新安装时并尝试initdb,它说该文件不为空?)

有点谷歌搜索,我找到了一些解决方案,但我不知道如何做到这一点

  1. 删除并重新添加启动代理
  2. 终止9.0.3
  3. 的流程
  4. 初始化db initdb / usr / local / var / postgres
  5. 重新启动计算机
  6. 最后2条指令很简单,但我不知道如何做第2条

    有什么建议吗?

1 个答案:

答案 0 :(得分: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