posts - 495,  comments - 11,  trackbacks - 0

          1. 下載PostgreSQL數據庫zip版本

          2.? 解壓到D盤,例如:D:\database\postgresql

          3.? cmd窗口進入D:\database\postgresq\bin,依次執行如下命令:
          set PGHOME=D:\database\postgresq
          set PGDATA=%PGHOME%\data
          set PGLIB=%PGHOME%\lib
          set PGHOST=localhost
          set PATH=%PGHOME%\bin;%PATH%

          4.? 添加用戶

          > 添加windows用戶,用于啟動PostgreSQL的windows服務

          D:\database\postgresql>net user postgres pgsqlpw /add /expires:never /passwordchg:no

          > 為保證安全,此用戶不允許本地登錄
          D:\database\postgresql>net localgroup users postgres /del

          > 賦于windows用戶postgres訪問PostgreSQL安裝目錄的權限
          D:\database\postgresql>cacls . /T /E /P postgres:R

          5.? 初始化數據庫

          > 切換到windows用戶postgres的命令行環境
          D:\database\postgresql>runas /noprofile /env /user:postgres "cmd"

          > 初始化數據庫,若不使用-U admin,則數據庫里自動添加當前windows用戶(即postgres)為數據庫帳號
          D:\database\postgresql>bin\initdb -D "D:\database\postgresql\data" -E UTF-8? --locale=chs -A md5 -U admin -W



          6. 啟動PostgreSQL服務:
          pg_ctl -D?D:\database\postgresql\data -l? D:\database\postgresql\pglog.txt start



          7. 創建并連接數據庫:
          createdb test
          psql -h localhost -w -d test



          8. 關閉PostgreSQL服務:
          pg_ctl -D? D:\database\postgresql\data stop

          9. 注冊為Windows服務:

          > 注冊為windows服務,當前windows用戶(即postgres)將作為PostgreSQL服務的登錄用戶
          D:\pgsql>bin\pg_ctl register -N PostgreSQL? -D “D:\database\postgresql\data

          > 啟動PostgreSQL服務
          D:\pgsql> sc start PostgreSQL

          ?

          ?

          posted on 2011-08-11 20:46 jadmin 閱讀(235) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 基隆市| 襄汾县| 姚安县| 墨玉县| 扎囊县| 红河县| 德兴市| 张北县| 霍邱县| 吴川市| 龙井市| 揭西县| 宜兰市| 文安县| 调兵山市| 岳阳县| 巫溪县| 蒲城县| 精河县| 麟游县| 纳雍县| 广安市| 嘉禾县| 广丰县| 德安县| 盐山县| 锦屏县| 荆门市| 多伦县| 文山县| 仙桃市| 盘锦市| 大理市| 海门市| 昭苏县| 蕉岭县| 沁源县| 民县| 田东县| 霍城县| 新干县|