【问题标题】:Postgresql with Rails 4.0.1 -- not running on localhost:3000 or deploying to Heroku带有 Rails 4.0.1 的 Postgresql——不在 localhost:3000 上运行或部署到 Heroku
【发布时间】:2013-12-10 17:40:45
【问题描述】:

当我尝试在我的 localhost:3000 上运行我的示例 Rails 4.0.1 应用程序时,我收到此错误:

PG:: ConnectionsBad 致命:角色“myapp”不存在。

我在 Maverick OSX 上运行并使用 Ruby 2.0。我完全按照https://devcenter.heroku.com/articles/getting-started-with-rails4 的指示创建了我的示例应用程序,但是当我尝试 '$ rails server' 时,我得到了上面的错误。我正在运行当前的 Postgres。我试图根据其他 stackoverflow 建议更改 pg_hba.conf,但到目前为止它仍然无法正常工作。我可以使用 MySQL3 在本地主机上运行,​​但不能使用 Postgresql。我想按照 Heroku 的建议在开发、测试和生产中运行 Postgresql。

参考: Rails: Deploying to Heroku, Many Problems, Repairing postgresql after upgrade to OSX Mavericks

【问题讨论】:

  • 你的database.yml是什么样的?
  • ps auxwww | grep postgres的输出是什么
  • 这是我的 database.yml... 开发:适配器:postgresql 编码:unicode 数据库:AAA_website_heroku_development 池:5 用户名:AAA_website_heroku 密码:测试:适配器:postgresql 编码:unicode 数据库:AAA_website_heroku_test 池:5用户名:AAA_website_heroku 密码:生产:适配器:postgresql 编码:unicode 数据库:AAA_website_heroku_production 池:5 用户名:AAA_website_heroku 密码:
  • 你创建了数据库吗?

标签: ruby heroku ruby-on-rails-4 rails-postgresql heroku-postgres


【解决方案1】:

我认为这是你的问题:

username: AAA_website_heroku 

对于 PG 的默认安装,用户名与您的计算机用户帐户的用户名相同。

【讨论】:

    【解决方案2】:

    如果您使用的是 Postgresql 数据库,您应该为您的数据库指定用户名和密码。在您的database.yml 中,我看不到您的密码。尝试在 Postgresql 中创建一个用户,并在 database.yml 中指定该用户的用户名和密码,然后再次运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-10
      • 2018-09-14
      • 2021-08-19
      • 2015-03-04
      • 2013-01-08
      • 1970-01-01
      • 2021-08-18
      相关资源
      最近更新 更多