gpt4 book ai didi

ruby-on-rails - 致命 : database "postgres" does not exist

转载 作者:行者123 更新时间:2023-11-29 11:24:50 25 4
gpt4 key购买 nike

奇怪的错误。所有帮助表示赞赏。

这是我的 database.yml

development:
adapter: postgresql
encoding: unicode
database: app_development
pool: 5
username: username
password:

test:
adapter: postgresql
encoding: unicode
database: app_test
pool: 5
username: username
password:

production:
adapter: postgresql
encoding: unicode
database: app_production
pool: 5
username: username
password:

当我手动创建数据库并尝试使用它们时,例如 rake db:test:preare 我收到以下错误:

FATAL:  database "postgres" does not exist

当我尝试删除数据库时出现以下错误:

Couldn't drop app_development : #<PG::Error: FATAL:  database "postgres" does not exist
>
Couldn't drop app_test : #<PG::Error: FATAL: database "postgres" does not exist
>
Couldn't drop app_production : #<PG::Error: FATAL: database "postgres" does not exist

如果我尝试使用 rake db:create:all 创建数据库,我会收到以下错误:

app_development already exists
app_test already exists
app_production already exists

看来我的database.yml没问题。但出于某种原因,它正在寻找一个名为 postgres 的数据库,而我的 database.yml 中没有该数据库。

感谢任何帮助。

编辑:

这里有更多来自 rake 的痕迹:

无法为 {"adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"app_production", "pool"=>5, "username"=>"创建数据库用户名", "密码"=>无

最佳答案

[Mac OS X] 我在使用 Linux 时从未遇到过 PostGreSQL 的任何问题。但是,我开始使用 MacBook 并遇到了与您相同的错误。所以...可能这不是您期望的解决方案,但这个应用程序解决了我所有的头痛问题。我只是想与大家分享。

http://postgresapp.com/

关于ruby-on-rails - 致命 : database "postgres" does not exist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10860288/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com