在華為雲上安裝了PostgreSQL,本地使用pgAdmin客戶端來訪問PostgreSQL
首先,需要在華為雲服務器上,放開訪問PostgreSQL的5432端口,否則會報請求超時
通過創建安全組來開放端口,創建好后不要忘記關聯實例
- 其次,配置PostgreSQL,在目錄/etc/postgresql/13/main,找到postgresql.conf文件修改允許訪問的主機
接着修改pg_hba.conf文件,添加允許訪問的ip地址
切換到postgres用戶進入sql命令行修改postgres賬戶的密碼
修改完成后切換到root用戶,使用命令systemctl restart postgresql重啟PostgreSQL
然后在pgAdmin中創建服務器,填上相應的數據
參考資料:
https://blog.csdn.net/drbinzhao/article/details/85953319
https://www.jianshu.com/p/e7fe45a10cee
https://blog.csdn.net/dongying1751/article/details/105208541
https://blog.csdn.net/gdp12315_gu/article/details/52468777