The version I chose is: postgresql-8.3.7-1-binaries-no-installer
First open the command line window under Windows (Start -> Start -> Type'cmd')
For example: under D:/postgreSQL
There is a directory named bin in this directory
Then move the head to the bin
Execute initdb.exe
Please remember to enter initdb.exe --help
Take a look at the input parameters of this executable file
The most important parameters are -D and -E
-D is the location where your data is to be stored
It is recommended that you put it on the upper level of the bin directory in order to achieve the spirit of true installation-free
-E is the encoding of your database, preferably UTF-8
So as not to encounter garbled problems
There will be a lot of messages
The message will show if posgreSQL has been installed
Because this step is very simple, there should be no error
At this point postgreSQL has been installed
Next, we need to create a postgreSQL management account
The same is to switch to the bin directory in the command line mode
The file createuser.exe executed this time
As an old saying, if you don’t use this executable file, enter --help(createuser.exe --help)
Let's see how to use this
Create a superuser similar to root
Then you can use this user to manage the database
At this step, your PostgreSQL has been installed
In the future, you can put the entire PostgreSQL into your pocketbook
Your database will follow you wherever you go~~
When you want to open the database, you must also enter the bin directory (in the command line mode of windows)
Use pg_ctrl to open and close the database
Open method: pg_ctl.exe start -D "Your storage location"
Shutdown method: pg_ctl.exe stop -D "Your storage location"
All done~~
My installation method is that I personally guarantee a feasible installation method under windowXP
Hope to help everyone
If you have any questions, please leave a message, everyone can discuss and discuss
First download postgresql-8.1.4-1-binaries-no-installer.zip, assuming that the decompressed directory is: D:/GreenAPP/pgsql ("$PG" is used below to indicate this directory).
Create a rootpass.txt file in the "$PG" directory, the content of which is the super user password of the database.
This concludes the preparation work, and the following steps are performed as an administrator.
Add a new postgres user and set the password to: p
net user postgres p /ADD /EXPIRES:NEVER /PASSWORDCHG:NO
net localgroup users postgres /delete
Create a data directory and set access permissions:
md data
cacls . /T /E /P postgres:R
cacls data /T /E /P postgres:C
Initialize the PostgreSQL database, you need to manually enter the postgres user password when switching users: p
runas /noprofile /env /user:postgres "bin/initdb -D data -E EUC_CN --locale=C -A md5 -U root –pwfile=rootpass.txt"
Or runas /noprofile /env /user:postgres enter the shell of user postgres and then run the initdb command
This is installed. It should be noted that the database default encoding is: EUC_CN (GB2312), the locale is set to: zh_CN.GBK, the database super user name is root, the password is rootpass.txt file content, and md5 authentication is used.
Can be used later:
runas /noprofile /env /user:postgres "$PG/bin/pg_ctl start -w -D $PG/data" to start PG, use:
$ PG / bin / pg_ctl stop -D $ PG / data -m smart 关闭 PG。