1. Install the installer setup.exe running Cygwin, select the following components Database / | --PostgreSQL for installation.
2. Set
The settings of the environment variable are added to the ~ / .bashrc as follows:
Export cygwin = server export pgdata = / usr / local / pgsql / data export pgcliencoding = EUC_CN
Add below ~ / .bash_profile: path = "/ usr / sbin: / sbin: $ {path}" Export Path Run $ source ~ / .bashrc $ source ~ / .bash_profile makes the settings take effect. CygServer settings
run
$ CygServer-Config
When you see prompt Yes / No, enter Yes, Enter.
Start CYGSERVER $ CYGSERVER & Initialization Database $ INITDB --NO-LOCALE --ENCODING = EUC_CN
3. Start running
Before $ pg_ctl start -w -w -i, you must confirm that CygServer is started. 4. Create user and database running
$ CREATEUSER -D -A PG $ createDb -u pg -o pg Test is created by the user PG and the user and owner are PG's database TEST. 4. Using the database
Run $ PSQL Test Pg as normal, that is, the prompt of PostgreSQL. Run
TEST = # /? The common command of PostgreSQL appears. You can now create a table, as well as inquiry, etc. (Don't make an example, because more simple) Exit the postgreSQL prompt command test = # / q 5. Stop
run
$ PG_CTL STOP to stop postgreSQL database services. 6. The supplementary installation process is more likely to have problems when INitdb. If an error, run the $ RM -RF / USR / local / PGSQL / DATA to delete the data path, and then run the initdb after resolving the problem. There is a very detailed installation guide here, you can refer to it.