【发布时间】:2012-01-28 04:37:50
【问题描述】:
我在我的应用程序中使用 Heroku,它需要 PostgreSQL,但您仍然可以使用 SQLite3 进行开发。由于 Heroku 强烈建议不要使用 2 个不同的数据库,我决定改用 PostgreSQL 进行开发。我安装了gem pg,还访问了PostgreSQL 官方站点以获取Windows 安装程序,还更改了我的database.yml。在安装过程中,它需要 PostgreSQL 的密码,所以我做了一个。
在尝试创建数据库时,我必须将 pg_hba.conf 文件从使用 md5 更改为 trust 才能通过:fe_sendauth: no password supplied。
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 trust # was md5
# IPv6 local connections:
host all all ::1/128 trust # was md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host replication postgres 127.0.0.1/32 trust
#host replication postgres ::1/128 trust
在摆脱了它之后,我现在得到了这个:
$ rake db:create
(in C:/app)
FATAL: role "User" does not exist
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"utf8",
"database"=>"app_test", "pool"=>5, "username"=>nil, "password"=>nil}
我的development.sqlite3 和text.sqlite3 仍然存在,这可能是问题吗?必须做什么?
这是我的全部要点:https://gist.github.com/1522188
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 postgresql