PostGreSQL資料庫安裝
阿新 • • 發佈:2020-09-10
一、下載
-
直接下載.tar.gz 安裝包,地址 https://www.enterprisedb.com/download-postgresql-binaries
-
使用
wget
命令下載(推薦)wget -c https://get.enterprisedb.com/postgresql/postgresql-10.5-1-linux-x64-binaries.tar.gz
二、解壓
tar -zxvf壓縮包
三、建立pgsql使用者並設定密碼
建立使用者和密碼都為postgres
四、建立pgsql資料目錄,並給postgres使用者授權
建立目錄:pgsql
使用者授權:chown postgres pgsql_data
五、初始化
切換使用者postgre
初始化資料庫
六、啟動資料庫
按照上面提示命令啟動資料庫
七、檢視程序
pgsql的預設埠:5432
八、連線資料庫
九、修改配置檔案設定可遠端訪問
也可單獨設定某個ip可訪問
0.0.0.0/0 代表所有 ip 都可以訪問。設定完需要重啟資料庫才能生效
啟動服務:/opt/develop/pgsql/bin/pg_ctl -D /opt/develop/pgsql/pgsql_data/ -l logfile start
停止服務:/opt/develop/pgsql/bin/pg_ctl -D /opt/develop/pgsql/pgsql_data/ -l logfile stop