在本地主机中运行的postgres服务器,但是postico,metasploit无法访问它。提问

时间:2020-06-08 16:48:32

标签: postgresql localhost macos-catalina metasploit postico

我刚刚购买了新的MacBook Pro(Catalina 10.15.5),并使用了旧MacBook的Time Machine,该机器使用的是同一操作系统(10.15.5),传输正常,但是现在第一次使用Postico时,我无法连接到本地主机。我收到错误消息。

    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
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 5432?

我显示我已经安装了postgressql,或者至少在我的brew列表中。我不确定是否需要在新的MacBook上运行此命令initdb /usr/local/var/postgres,因为我几乎将旧MacBook的硬盘复制到了新模式的恢复模式下?

是否可以通过问题Postico无法连接到新Mac上的localhost?我也使用Metasploit,也出现连接错误。

[-] * WARNING: No database support: could not connect to server: Connection refused
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 5432?

[-] ***

现在,我只是想解决Postico问题和所有postgressql问题。稍后我会解决metasploit问题。

1 个答案:

答案 0 :(得分:0)

此时不运行initdb。如果$ PGDATA目录中仍然有文件,它将拒绝运行。您需要检查服务器是否正在实际运行。请参阅此SO答案以获取更多信息: How to start PostgreSQL server on Mac OS X?

如果服务器正在运行,则检查postgresql.conf以将哪些listen_addresses设置为: https://www.postgresql.org/docs/12/runtime-config-connection.html

要排除主机问题,请尝试使用-h 127.0.0.1或:: 1(如果尚未安装)进行连接。