![](/img/trans.png)
[英]db:migrate (PostgreSQL) fails on Rails deployment with Capistrano
[英]Rails postgresql DB connection fails
我是Ruby和Postgres的新手。
下面是我的database.yml
development:
adapter: postgresql
database: test_database
username: postgresql
password: mypassword
host: localhost
encoding: utf8
該用戶存在,並且我能夠使用phpPgadmin中的相同憑據登錄。 但是,當我啟動Rails服務器並轉到應用程序的主頁時,我得到了FATAL: Ident authentication failed for user "postgresql"
。
編輯:如果pghba.conf很重要,
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
#local all all peer
local all postgres md5
local all postgresql md5
有人可以幫忙嗎?
打開PostgreSQL客戶端認證配置文件
vi /var/lib/pgsql/data/pg_hba.conf
這個文件管理下面的東西
默認情況下,Postgresql使用基於IDENT的身份驗證。 您要做的就是允許您的網絡或Web服務器基於用戶名和密碼的身份驗證。 IDENT絕對不允許您通過-U和-W選項登錄。 追加以下內容以僅允許通過本地主機登錄:
local all all trust
host all 127.0.0.1/32 trust
保存並關閉文件。 重新啟動Postgresql服務器:
service postgresql restart OR
sudo /etc/init.d/postgresql restart
它應該工作
我可以在路徑中找到我的pg_hba.conf文件:
/etc/postgresql/8.4/main/pg_hba.conf
對於仍然找不到pg_hba.conf文件的任何人,我使用的是PostgreSQL v9.2,並且在以下位置找到了我的:
/var/lib/pgsql/9.2/data/pg_hba.conf
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.