Simple PostgreSQL installation procedure

Source: Internet
Author: User
Tags psql

Download the window No Install Version at www.sqlsql.com and decompress it to the hard disk. the following commands are all in the bin directory.

Step 1. initialize the database
Initdb-d directory-e encoding [-u username] -- locale = C
Directory specifies the directory where data files are stored. database files will be created under this directory.
Encoding Character Set
Username administrator user, corresponding to a user in the operating system. This user can manage the database
Note:
Directory cannot be created in advance
After the database is initialized, The Postgres and template1 databases will be automatically created.
Use a non-administrator to run thisProgram

Step2. register the service
Register the window service
Pg_ctl register [-N servicename] [-u username] [-P Password] [-D datadir]
You can use the [-u username] [-P Password] parameters to specify the user who runs the service. For security reasons, you must use a non-administrator user to run the service.
Datadir takes the DIRECTORY parameter in step 1, and grants the user running the service full control permission to the directory.

If you feel uncomfortable, you can log out of the window service.
Pg_ctl unregister [-N servicename]

Step 3: Create a database
Createdb dbname

Step 4. Set the Client Login Mode
Open the pg_cmd.conf file under the data storage directory (that is, the DIRECTORY parameter specified in step 1 ).
At the end of the file, you can add a client that allows connection. Each line is a record, and the last field method is used to specify the login authentication method,
If it is set to trust, it means you can log on without verification.
If it is set to MD5, it means that MD5 is used for password verification. Other types of methods are not currently used

Step 5. You can use the Psql program to log on to the service and enter the SQL command line.
Psql dbname-H hostname_or_host_ip [-P post] [-u username]

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.