postgresql in windows (including win7) installation and configuration under

2010-02-04  来源:本站原创  分类:Database  人气:310 

First of all, the following is commonly used commands:

③ initdb initialize database.
④ pg_ctl start start the database ⑤ pg_ctl stop to stop the establishment of a database ⑥ post_svc-install windows nt service (need to set system environment variables)
⑦ post_svc-remove remove windows nt service ⑧ use the "createdb database name" New Database ⑨ use the "createuser user name" to create a database account ⑩ use "psql-h localhost-d database name - U user name" into the database

Then to explain:

First, download postgresql for windows

Free installation, direct decompression to the hard drive of a directory. The author in d: \ pgsql

Second, set the environment variable, you can write a BAT to the following

set PGHOME = d: \ pgsql
set PATH =% PGHOME% \ bin;% path%
set PGHOST = localhost
set PGLIB =% PGHOME% \ lib
set PGDATA =% PGHOME% \ data

I write them a inst.bat

D: \ pgsql> inst

D: \ pgsql> set PGHOME = d: \ pgsql

D: \ pgsql> set PATH = d: \ pgsql \ bin; d: \ pgsql \ bin; d: \ pgsql \ bin; C: \ Windows \ system32; C: \
Windows; C: \ Windows \ System32 \ Wbem; C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \; C: \
Program Files \ Common Files \ Thunder Network \ KanKan \ Codecs; C: \ Program Files \ Micros
oft SQL Server \ 90 \ Tools \ binn \; d: \ MATLAB7 \ bin \ win32;

D: \ pgsql> set PGHOST = localhost

D: \ pgsql> set PGLIB = d: \ pgsql \ lib

D: \ pgsql> set PGDATA = d: \ pgsql \ data

Third, initialize the database

D: \ pgsql> initdb - locale = C
The files belonging to this database system will be owned by user "Administrator
. "
This user must also own the server process.

The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to "english".

fixing permissions on existing directory d: / pgsql / data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in d: / pgsql/data/base/1 ... ok
initializing pg_authid ... 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

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the-A option the
next time you run initdb.

Success. You can now start the database server using:

"Postgres"-D "d: / pgsql / data"
"Pg_ctl"-D "d: / pgsql / data"-l logfile start

IV start

D: \ pgsql> pg_ctl start

5, re-open a MSDOS window

Create a database to mydb Case

D: \ pgsql> createdb-h mydb

Create User

D: \ pgsql> createuser-h deepfuture
Shall the new role be a superuser? (Y / n) y

D: \ pgsql>

D: \ pgsql>

6, start a graphical interface to start running

Start pgAdmin3.exe process configuration (in the BIN directory)

postgresql in windows (including win7) installation and configuration under


postgresql in windows (including win7) installation and configuration under