Postgresql在Windows下的解壓安裝
1.將下載的壓縮包解壓,我是解壓在D:\postgreSQL\pgsql中。
2.設(shè)置環(huán)境變量如下:
set PGHOME=D:\postgreSQL\pgsql
set PGDATA=%PGHOME%\data
set PGLIB=%PGHOME%\lib
set PGHOST=localhost
set PATH=%PGHOME%\bin;%PATH%
3.創(chuàng)建數(shù)據(jù)庫,利用pgsql\bin目錄下的initdb.exe命令,我用的格式如下:
initdb --locale=CHS -E UTF8 -D "myPostgre" -U postgre –W postgre
關(guān)于initdb的詳細(xì)參數(shù),可以用initdb --help來查看。
若是執(zhí)行成功,有如下log信息:
creating directory postgre ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in postgre/base/1 ... ok
initializing pg_authid ... ok
Enter new superuser password:
Enter it again:
setting password ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
上面紅色的地方需要輸入數(shù)據(jù)庫超級用戶的密碼。
4.成功安裝后,在windows中添加用戶 postgre,該用戶就是之前在initdb命令中-U 后的用戶名。
5.啟動數(shù)據(jù)庫和停止數(shù)據(jù)庫的命令為:
pg_ctl -D "myPostgre" start pg_ctl -D "myPostgre" stop
然后就可以開始postgresql的學(xué)習(xí)之旅了:)。
我也是剛開始學(xué)習(xí)postgresql,主要是想利用其空間數(shù)據(jù)庫的功能來完成一些GIS方面的應(yīng)用。
希望能和大家多交流交流,同時能得到高手的指教!

浙公網(wǎng)安備 33010602011771號