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)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 阳信县| 文安县| 凤山县| 建德市| 永宁县| 庆元县| 历史| 龙岩市| 元阳县| 新昌县| 乐昌市| 新和县| 上蔡县| 纳雍县| 读书| 武乡县| 宁晋县| 思南县| 武鸣县| 南充市| 荆门市| 赞皇县| 惠来县| 邵阳县| 余姚市| 固原市| 万全县| 大埔县| 塘沽区| 宜春市| 贡觉县| 安福县| 晋宁县| 元江| 四会市| 忻城县| 云龙县| 井陉县| 阜平县| 石景山区| 五常市|