人生就是不斷學習,調整與更新持續前進。

使用 PostgreSQL SSH連線與設置port號 (Cloud Server)

資料設置 port與更改設定檔案位置:


/etc/postgresql/14/main/postgresql.conf
port = 5432    # 5432是postgresql預設port 
listen_addresses = '*' 

 

重啟與狀態檢視指令:


sudo systemctl status postgresql
sudo systemctl restart postgresql



連線範例:(使用者用 deploy為例子)


ssh -L 5432:127.0.0.1:5432 
deploy@ip-addr -p 22 psql -h 127.0.0.1 -p 5432 -U deploy -d database_name