1、初始化並創建資料庫(一次即可) initdb -D C:\Soft\PostgreSQL\10\data -E UTF-8 --locale=chs -U postgres -W You can now start the database server using(啟動資料庫命令): pg_c ...
1、初始化並創建資料庫(一次即可)
initdb -D C:\Soft\PostgreSQL\10\data -E UTF-8 --locale=chs -U postgres -W
You can now start the database server using(啟動資料庫命令):
pg_ctl -D ^"C^:^\Soft^\PostgreSQL^\10^\data^" -l logfile start
--家裡電腦pg 啟動路徑
C:/Users/computer/scoop/apps/postgresql/current/bin/pg_ctl -D ^"C^:^\Users^\computer^\scoop^\apps^\postgresql^\current^\data^" -l logfile start
2、配置環境變數的vbs腳本
on error resume next set sysenv=CreateObject("WScript.Shell").Environment("system") '系統環境變數的數組對象 Path = CreateObject("Scripting.FileSystemObject").GetFolder(".").Path '添加變數 sysenv("PGHOME")="C:\Soft\PostgreSQL\10" sysenv("PGHOST")="localhost" sysenv("Path")=sysenv("PGHOME")+"\bin;"+sysenv("Path") sysenv("PGLIB")=sysenv("PGHOME")+"\lib" sysenv("PGDATA")=sysenv("PGHOME")+"\data" wscript.echo "PostgreSQL環境變數安裝成功!不需要重新啟動電腦啊!"
3、Postgresql註冊成windows 服務
>pg_ctl.exe register -N "pgsql" -D "C:\Soft\PostgreSQL\10\data"