我爲我的應用程序使用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