Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 使用pgAdmin连接到Rails应用程序Postgres DB_Ruby On Rails_Postgresql_Pgadmin - Fatal编程技术网

Ruby on rails 使用pgAdmin连接到Rails应用程序Postgres DB

Ruby on rails 使用pgAdmin连接到Rails应用程序Postgres DB,ruby-on-rails,postgresql,pgadmin,Ruby On Rails,Postgresql,Pgadmin,我无法使用pgAdmin连接到Rails应用程序的数据库。我让服务器运行,我相信我的服务器属性在pgAdmin中是正确的。以下是pgAdmin服务器属性中的内容: Name: achievenext_dev Host: localhost port: 3000 SSL: Maintenance DB: postgres username: achievenext password: ****** Store password: true Restore env?: true DB Restric

我无法使用pgAdmin连接到Rails应用程序的数据库。我让服务器运行,我相信我的服务器属性在pgAdmin中是正确的。以下是pgAdmin服务器属性中的内容:

Name: achievenext_dev
Host: localhost
port: 3000
SSL:
Maintenance DB: postgres
username: achievenext
password: ******
Store password: true
Restore env?: true
DB Restriction: 
Service:
Connect now: true
在my database.yml文件中:

development:
  adapter: postgresql
  host: localhost
  username: achievenext
  password: ******
  database: achievenext_dev
但当我尝试连接pgAdmin时,返回以下错误:

发生了一个错误:

连接到服务器时出错:服务器 意外地关闭了连接。这可能意味着服务器在处理请求之前或处理请求时异常终止


但是我的服务器上没有错误。它似乎运行良好。无法找出我在这里做错了什么。

能否尝试使用127.0.0.1而不是localhost?
我知道mysql经常会导致问题,它会尝试连接到套接字文件,而不是进行TCP连接。

尝试向
development.yml
文件添加端口。尤其是运行windows操作系统时


默认端口是
端口:5432
,我不确定在pgAdminIII中指定
端口:3000
是否会导致问题。

感谢您的评论Danny,我尝试使用127.0.0.1代替localhost,但这也不起作用。主机:127.0.0.1代替localhost在mac上对我有效。非常感谢你的建议!