如何连接我的本地postgresql和本地ip地址
问题描述:
我的问题是,我在我的Mac上安装postgresql,然后我想连接我的postgresql和我的本地IP地址。如何连接我的本地postgresql和本地ip地址
例如,我的本地IP地址是:10.xxx.xxx.xxx,我想命令psql -U username -d dbname -h 10.xxx.xxx.xxx
命令psql -U username -d dbname -h 127.0.0.1
。
我已将我的IP地址添加到pg_hba.conf
,并将listen_address
更改为postgresql.conf
为listen_address = '*'
,但无效。
感谢您的回答。
答
将您的本地IP添加到/etc/hosts
文件中,然后再试一次。如下图所示:
127.0.0.1 localhost
10.xxx.xxx.xxx localhost
+0
Thx。你的回答解决了我的问题〜 – xiaoyusilen
检查,如果端口是127.0.0.1,10.xxx.xxx.xxx –
我的意思之间的开放10.xxx.xxx.xxx等于127.0.0.1我只有一台电脑。 – xiaoyusilen
你有没有尝试连接,通常没有-h选项 –