【问题标题】:creating user with postgresql FATAL error使用 postgresql 致命错误创建用户
【发布时间】:2014-06-18 22:06:05
【问题描述】:

我使用 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. 初始化数据库 initdb /usr/local/var/postgres
  4. 重启我的电脑

最后两条指令非常简单,但我不知道如何执行前两条

有什么建议吗?

【问题讨论】:

    标签: ruby-on-rails ruby postgresql


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 2015-04-01
      • 2012-08-08
      • 2017-03-23
      • 1970-01-01
      • 1970-01-01
      • 2015-01-18
      • 2021-04-01
      • 2017-09-25
      • 1970-01-01
      相关资源
      最近更新 更多