使用 pgAdmin 连接到 Rails 应用程序 Postgres DB
我在使用 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
在我的 database.yml 文件中:
development:
adapter: postgresql
host: localhost
username: achievenext
password: ******
database: achievenext_dev
但是当我尝试连接 pgAdmin 时返回此错误:
发生错误:
连接到服务器时出错:服务器 意外关闭连接。这可能意味着服务器在处理请求之前或处理过程中异常终止。
但我的服务器上没有任何错误。它似乎运行良好。无法弄清楚我在这里做错了什么。
I'm having trouble connecting to the database for my Rails app using pgAdmin. I have the server running and I believe that my server properties are correct in pgAdmin. Here's what I have in pgAdmin server properties:
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
And in my database.yml file:
development:
adapter: postgresql
host: localhost
username: achievenext
password: ******
database: achievenext_dev
But when I try to connect pgAdmin returns this error:
An error has occurred:
Error connecting to the server: server
closed the connection unexpectedly. This probably means the server terminated abnormally before or while processing the request.
But there are no errors on my server. It appears to be running fine. Can't figure out what I'm doing wrong here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将端口添加到您的
development.yml
文件中。特别是如果您运行 Windows 操作系统。默认端口是
port:5432
,我不确定在 pgAdminIII 中指定port:3000
是否会导致问题。Try adding a port to your
development.yml
file. Especially if you run a windows OS.The default port is
port:5432
and I'm not sure if specifying theport:3000
in your pgAdminIII would cause problems.您可以尝试使用 127.0.0.1 而不是 localhost 吗?
我知道mysql经常会导致问题,它会尝试连接到套接字文件而不是建立TCP连接。
Can you try to use 127.0.0.1 instead of localhost?
I know mysql often causes problems that it will try to connect to the socket file instead of making a TCP connection.