PG ::错误:无法连接到服务器:连接被拒绝

时间:2017-02-24 14:19:02

标签: ruby-on-rails postgresql

当您array(1 0 => array(4 0 => $a 1 => $b 2 => $c 3 => $d ) ) 出现错误时

rake db:migrate:up VERSION="

postgresql.conf中

PG::Error: could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5454?

其他项目的迁移工作正常

#listen_addresses = 'localhost'     # what IP address(es) to listen on;
                    # comma-separated list of addresses;
                    # defaults to 'localhost'; use '*' for all
                    # (change requires restart)
port = 5432             # (change requires restart)

如何删除错误? gem 'pg' 0.14.1 postgresql 9.3 端口在哪里?

如果我更改5454中的端口会导致其他项目中的迁移失败吗?

1 个答案:

答案 0 :(得分:0)

好像你已经更改了config/database.yml中的端口。您可以在5432

中看到默认端口 postgresql.conf
development:
  adapter: postgresql
  encoding: utf8
  reconnect: false
  database: development
  pool: 5
  username: postgres
  password: password
  host: localhost
  port: 5454 # Change it to 5432