【问题标题】:pgAdmin can't connect to the local database serverpgAdmin 无法连接到本地数据库服务器
【发布时间】:2020-12-06 18:42:04
【问题描述】:

我刚刚将 pgAdmin 更新到 4.23 版,将 PostgreSQL 更新到 12 版。我还删除了所有以前的数据库和 pgAdmin 安装。所以它应该是一个全新的安装(我还清理了以前版本的所有剩余部分)。

现在,当我尝试连接到本地数据库服务器时,我什至还没有输入密码:

could not connect to server: Connection refused (0x0000274D/10061)Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5433? 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 5433?

服务正在运行,我可以使用命令行工具,它响应正确,但由于某种原因我无法使用 pgAdmin。

>psql -V
psql (PostgreSQL) 12.3

【问题讨论】:

  • 在`postgresql.conf`和pg_hba.conf中改变你的listen_address

标签: postgresql pgadmin


【解决方案1】:

通过网络访问 PostgreSQL

在文件/etc/postgresql/{version_number}/main/postgresql.conf 中将listen_address localhost 更改为*

# - Connection Settings - 
listen_addresses = '*'          # what IP address(es) to listen on;     

pg_hba.conf的变化

在 # IPv4 本地连接中添加以下行:

host    all             all             0.0.0.0/0               md5

和评论

#host    all             all             127.0.0.1/32            md5

【讨论】:

  • 什么也没做。
  • 需要重启数据库。
  • 我该怎么做?.. 我之前已经停止了服务,并在更改文件后重新启动了它。还有其他方法吗?
【解决方案2】:

您的问题的副本

https://stackoverflow.com/questions/4482239/postgresql-database-service

查看此线程,因为它说明了多个解决方案

https://stackoverflow.com/questions/24917832/how-connect-postgres-to-localhost-server-using-pgadmin-on-ubuntu

【讨论】:

  • 其中大部分是关于更改密码或更改pg_hba.conf 文件的。我在重新安装之前和之后都试过了,它完全没有任何作用。至少,在重新安装期间,它创建了postgres 用户并且我能够给它一个密码。现在我可以登录并使用命令行工具手动执行操作。但不是 pgAdmin,这真的很令人沮丧。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-09-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多