Postgresql 9.4.0-1 x64 win7 解壓版安裝步驟

來源:互聯網
上載者:User

標籤:

 

一、下載解壓

1,下載postgresql-9.4.0-1-windows-x64-binaries.zip

2,解壓postgresql-9.4.0-1-windows-x64-binaries.zip 到E:\

二、添加使用者

1,添加windows使用者,用於啟動PostgreSQL的windows服務
net user postgres pgsqlpw /add /expires:never /passwordchg:no

2,為保證安全,此使用者不允許本地登入
net localgroup users postgres /del

3,賦於windows使用者postgres訪問PostgreSQL安裝目錄的許可權
cacls . /T /E /P postgres:R

4、配置環境變數:

三、初始化資料庫

1、配置環境變數:

PG_HOME = E:\postgresql-9.4.0-1-windows-x64

PGDATA = %PG_HOME%\data

PGHOST = localhost

PGLIB = %PG_HOME%\lib

Path = %path%; %PG_HOME%\bin;

2,切換到windows使用者postgres的命令列環境
runas /noprofile /env /user:postgres  cmd 

註: 用管理員帳號,把postgres 帳號初始化,改下密碼就可以了。

3,初始化資料庫,若不使用-U admin,則資料庫裡自動添加當前windows使用者(即postgres)為資料庫帳號
initdb.exe -D E:\postgresql-9.4.0-1-windows-x64\data -E UTF-8 --locale=chs

4,啟動資料庫
pg_ctl.exe -D E:\postgresql-9.4.0-1-windows-x64\data -l logfile start

5,停止資料庫
pg_ctl.exe -D E:\postgresql-9.4.0-1-windows-x64\data stop

四、註冊為Windows服務

1,註冊為windows服務,當前windows使用者(即postgres)將作為PostgreSQL服務的登入使用者
   pg_ctl.exe register -D E:\postgresql-9.4.0-1-windows-x64\data -NPostgreSQL

2,啟動PostgreSQL服務
net start PostgreSQL 

 

五、串連測試

psql -Upostgres -W

Postgresql 9.4.0-1 x64 win7 解壓版安裝步驟

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.