First, download unzip
1, download postgresql-9.4.0-1-windows-x64-binaries.zip
2, unzip postgresql-9.4.0-1-windows-x64-binaries.zip to E:\
Second, add users
1. Add Windows user to start PostgreSQL windows service
NET user Postgres Pgsqlpw/add/expires:never/passwordchg:no
2, to ensure security, this user is not allowed to log on locally
net localgroup users Postgres/del
3, assign windows user postgres access to the PostgreSQL installation directory
cacls. /T/E/P Postgres:r
4. Configure Environment Variables :
Third, initialize the database
1. Configure environment Variables :
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. switch to the Windows user postgres Command-line environment
Runas/noprofile/env/user:postgres cmd
Note: With the Administrator account, the postgres account initialization, change the password on it.
3, Initialize the database , If you do not use- u admin, The database automatically add the current Windows user ( that is , postgres) is the database account number
initdb.exe-d E:\postgresql-9.4.0-1-windows-x64\data-E UTF-8--locale=chs
4. Start the database
Pg_ctl.exe-d E:\postgresql-9.4.0-1-windows-x64\data-l logfile Start
5, Stop the database
Pg_ctl.exe-d E:\postgresql-9.4.0-1-windows-x64\data Stop
Iv. registering as a Windows service
1, registered as a Windows service , the current windows user ( IE postgres) will act as a login user for the PostgreSQL Service
Pg_ctl.exe register-d E:\postgresql-9.4.0-1-windows-x64\data-NPostgreSQL
2. start the PostgreSQL service
net start PostgreSQL
Five , Connection Test
Psql-upostgres-w
Postgresql 9.4.0-1 x64 Win7 decompression version installation steps