我正在尝试在Ubuntu机器上设置PostgreSQL数据库.我希望能够使用pgAdmin3从远程计算机访问它.我该如何设置?
我在Ubuntu上安装了PostgreSQL数据库:
sudo apt-get install postgresql
在我的/etc/postgresql/9.1/main/pg_hba.conf中我有这一行:
host all all all password
因此它应接受来自所有IPv4地址的连接,并且密码应以明文形式发送(这是出于开发原因).
如果我运行此命令以查看正在运行的服务:
sudo netstat -tulpn
我可以看到这些行,这表明PostgreSQL正在接受默认端口上的连接:
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
3561/postgres
当我尝试从同一本地网络上的远程计算机连接到此PostgreSQL服务器时,我收到以下错误消息:
Server doesn’t listen
The server doesn’t accept connections: the connection library reports
could not connect to server: Connection refused Is the server running on host “10.0.1.7” and accepting TCP/IP connections on port 5432?
我使用postgres作为用户名而没有密码.但我也试过postgres作为密码.在本地服务器上,我可以使用:
sudo -u postgres psql postgres
如何使用pgAdmin3从远程计算机连接到在Ubuntu上运行的PostgreSQL数据库?