切换数据库问题

时间:2013-04-24 18:22:11

标签: ruby-on-rails postgresql

我刚将我的应用程序从SQLite3切换到PostgreSQL,当我尝试在http://localhost:3000/上加载页面或运行rake db:migrate时,我得到:

could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?

数据库YAML:

development:
  adapter: postgresql
  database: store_delevopment
  pool: 5

(现在我使用默认的Rails服务器在开发模式下使用statring服务器。)

1 个答案:

答案 0 :(得分:1)

将这些条目的方法更改为PostgreSQL data/pg_hba.conf文件中的“trust”:

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust