远程访问postgresql数据库

 1: ssh 登录远程的PostgreSQL database server:

ssh username@ipaddress

2: Enable client authentication:

编辑 /etc/postgresql/9.1/main目录下的文件:

postgresql.conf:

listen_addresses= 'localhost' 换成

listen_addresses= '*'

pg_hba.conf

在IPv4 local connections下面,添加:(sudo vi 打开)

host         all            all           0.0.0.0/0       md5

3: Restart PostgreSQL Server

sudo /etc/init.d/postgresql start

4: Access command

psql -h IPadrress -U username -d database





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章