Windows under PostgreSQL installation and configuration

Source: Internet
Author: User
Tags locale postgresql

https://www.postgresql.org/download/

Download the installer certified by Enterprisedb for all supported PostgreSQL versions.

This installer includes the PostgreSQL server, pgadmin; A graphical tool for managing and developing your databases, and stackbuilder; A package manager, can be used to download and install additional PostgreSQL tools and drivers. Stackbuilder includes management, integration, migration, replication, geospatial, connectors and other tools.

You can download the Consolidated installation package: Includes PostgreSQL server,pgadmin A graphical interface client, Stackbuilder is responsible for managing integrated migration replication.

PostgreSQL's documentation was not friendly, I only found the Linux class system documentation. Then began to step on their own pits.

The file is exe if there is no DirectX or Microsoft Visual C + + redistributable (x64) ... Something like that it will automatically help install, so don't worry. (One of the reasons for choosing PostgreSQL is that MySQL's install-free package does not provide this type of support, manual is not resolved, other benefits are not yet available)

Setting environment variables

Create a new file with a VBS extension that reads as follows and double-click Execute.

On Error Resume Next set Sysenv=createobject ("Wscript.Shell"). Environment ("system") ' the array object of the systems environment variable Path = CreateObject ("Scripting.FileSystemObject"). GetFolder ("."). Path ' Add variable sysenv ("pghome") = "D:\pgsql" sysenv ("PGHOST") = "localhost" sysenv ("Path") =sysenv ("pghome") + "\ Bin;" +sysenv ("Path") sysenv ("Pglib") =sysenv ("pghome") + "\lib" sysenv ("PGDATA") =sysenv ("pghome") + "\data" WScript.Echo " PostgreSQL environment variable installed successfully! No need to restart the computer Ah! "

Initializing the database

At the command line, it is best to right-click Administrator privileges (which are also used below).

initdb.exe-d D:\pgsql\data-E UTF-8--locale=chs-u postgres-w

-D: Specifies the storage directory for the database cluster E:\pgsql\data

-e: Default encoding Format UTF8

--locale: About regional Settings (Chinese-simplified-china)

-U: Specifies the user name of the Super user for DB Postgres

-W: Tips for assigning passwords to super users

Installing Windows Services

Pg_ctl register-n postgresql-d D:\pgsql\data (be sure to have Administrator privileges)

Windows under PostgreSQL installation and configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.