PostgreSQL installation and configuration tutorial on Windows and postgresql installation tutorial

Source: Internet
Author: User

PostgreSQL installation and configuration tutorial on Windows and postgresql installation tutorial

PostgreSQL extension PostGIS is the most famous open source GIS database.
Installing PostgreSQL is the first step.

1. Download the binary Installation File of PostgreSQL.

PostgreSQL official website-> Download-> Windows 64-bit ,:
(1) Official Website:
Https://www.postgresql.org/

(2) Download:
Https://www.postgresql.org/download/

Https://www.postgresql.org/download/windows/


(3) Windows 64-bit (based on your system version)
Https://www.enterprisedb.com/download-postgresql-binaries

2. decompress the package and configure the environment variables.

(1) first create a folder named data under the pgsql (D: \ 01Software \ Database \ postgresql-9.6.2-2-windows-x64-binaries \ pgsql) folder (this is the data storage folder of the Database)

(2) create a file named env. vbs in the pgsql folder.
The file content is as follows:

on error resume nextset sysenv=CreateObject("WScript.Shell").Environment("system") 'system environment arrayPath = CreateObject("Scripting.FileSystemObject").GetFolder(".").Path 'add variablesysenv("PGHOME")="D:\01Software\Database\postgresql-9.6.2-2-windows-x64-binaries\pgsql"sysenv("PGHOST")="localhost"sysenv("Path")=sysenv("PGHOME")+"\bin;"+sysenv("Path")sysenv("PGLIB")=sysenv("PGHOME")+"\lib"sysenv("PGDATA")=sysenv("PGHOME")+"\data"wscript.echo "PostgreSQL Success"

(3) finally run this script

3. initialize the database

Open the command prompt as an administrator, locate to the bin directory, and enter the following command:

Copy codeThe Code is as follows: initdb.exe-D: \ 01Software \ Database \ postgresql-9.6.2-2-windows-x64-binaries \ pgsql \ data-E UTF-8 -- locale = chs-U postgres-W

-U postgres indicates that the superuser's username is postgres.

4. Start the database

Enter the following command in the bin directory as an administrator to generate a logfile file in the specified path.

Copy codeThe Code is as follows: pg_ctl-D: \ 01Software \ Database \ postgresql-9.6.2-2-windows-x64-binaries \ pgsql \ logfile-l logfile start

5. register the service

Run the following command in the bin directory as an administrator and then start the service.

Copy codeCode: pg_ctl register-N PostgreSQL-D: \ 01Software \ Database \ postgresql-9.6.2-2-windows-x64-binaries \ pgsql \ data

6. Use PgAdmin to establish a database connection

Under D: \ 01Software \ Database \ postgresql-9.6.2-2-windows-x64-binaries \ pgsql \ pgAdmin 4 \ bin, there is pgadmin4.exe, double-click to open.

I am using the connection established by the Super User postgres.

Reference: how to download and configure Postgresql in Windows

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.