2017-07-25 74 views
0

我的问题是,我在我的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.conflisten_address = '*',但无效。

感谢您的回答。

+0

检查,如果端口是127.0.0.1,10.xxx.xxx.xxx –

+0

我的意思之间的开放10.xxx.xxx.xxx等于127.0.0.1我只有一台电脑。 – xiaoyusilen

+0

你有没有尝试连接,通常没有-h选项 –

回答

0

将您的本地IP添加到/etc/hosts文件中,然后再试一次。如下图所示:

127.0.0.1 localhost 
10.xxx.xxx.xxx localhost 
+0

Thx。你的回答解决了我的问题〜 – xiaoyusilen