我为我的应用程序使用Heroku,它需要PostgreSQL,但仍可以使用SQLite3进行开发。由于Heroku强烈建议不要有2个不同的数据库,我决定改用PostgreSQL进行开发。我安装了gem pg
,并且还去了官方的PostgreSQL站点以获得Windows安装程序,并且还更改了我的database.yml
。在安装期间,它需要PostgreSQL的密码,所以我做了一个。 我不得不将pg_hba.conf
文件从使用md5
改为trust
,以便在尝试创建数据库时获得过去:fe_sendauth: no password supplied
。使用PostgreSQL时,角色不存在并且无法创建数据库
# 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
它不让我进入'psql.exe'。当我尝试打开它时,窗口出现,然后自动关闭,所以我然后尝试进入cmd提示符并在'c:\ Program Files .. \ .. \ bin> psql.exe> psql:FATAL:角色“用户”不存在“再次获得”致命“。有任何想法吗? – LearningRoR 2011-12-26 23:40:37
@wrbg:你在安装过程中创建了一个'postgres'用户,对吧?试试'psql -d postgres -U postgres',如果你需要密码,那么'psql -d postgres -U postgres -W'。 – 2011-12-26 23:49:14
它在安装期间没有提示用户。让我看看重新安装。 – LearningRoR 2011-12-27 00:12:56