安裝
https://www.yoytang.com/postgres-windows-install-and-config.html
下載最新的zip包 http://get.enterprisedb.com/postgresql/postgresql-9.5.2-1-windows-x64-binaries.zip
配置環境變量
initdb -D E:\postgresql\pgsql12\data -U postgres
postgres -D E:\postgresql\pgsql12\data
登陸
E:\postgresql\pgsql\bin>psql -h localhost -U postgres -d postgres -p 5432
-h:數據庫IP
-U:登錄用戶
-d:登錄的數據庫
-p:登錄端口
修改密碼
alter user postgres with password '123456';
查看數據庫
\l
進入對應的庫
退出數據庫
\q
重啟服務
pg_ctl -D "E:\postgresql\pgsql\data" -l logfile restart
pg_ctl -D "E:\postgresql\pgsql\data" -l logfile start
查看狀態
pg_ctl -D "E:\postgresql\pgsql\data" -l logfile status
關閉服務
pg_ctl -D "E:\postgresql\pgsql\data" -l logfile stop