Install, configure PostgreSQL9.1 on Ubuntu12.04

Source: Internet
Author: User
Tags postgresql

1. Installing PostgreSQL

Execute command: Apt-get update

Get the latest server, or the installation will appear after 404

Execute command: Apt-get install PostgreSQL get installation package

Enter Y to install automatically

After successful installation, the default is to create a database named Postgres, a Linux system user named Postgres, and a database user named Postgres.

2, modify the database default user postgres password, so that you can use the client software (Pgadmin III, etc.) telnet to the database

1) Log in to the database

Way One:

Way two:

2) Exit the database

Command: \q

3) Modify the Postgres user password

Modify the password for the Postgres user to "Panda"

3. Modify the password of the system user named Postgres (you will need to enter this password when you log in to the database as a non-root user)

1) Delete the system user password (you do not need to enter a password when you log in to the database using a non-root user)

Execute command: sudo passwd-d postges

2) Modify the system user password (for security reasons)

3) Log in to the database as a non-root user, you need to enter the system user password just modified

4. Database Management

1) Create a database user

Way One:

Log in to database, create new user, name in double quotes, case sensitive

Way two:

Switch users, create new users

-A does not allow other users to be created

-D user Cannot create database

-P need to enter a password

2) View new users that have been created

3) Create a database

Specify the database user when creating the database:

5. Related configuration of external remote Access database (database client software pgadmin III)

1) Edit configuration file:/etc/postgresql/9.1/main/postgresql.conf

Modify the Listener address permission to receive any connection:

#listen_addresses = ' localhost ' changed to listen_addresses = ' * '

Enable password verification:

#password_encryption = on change to password_encryption = On

2) Edit configuration file:/etc/postgresql/9.1/main/pg_hba.conf

At the end of the file, add the following:

Host All 0.0.0.0/0 MD5

After the configuration is complete, you need to restart the database:

Execute command:/etc/init.d/postgresql restart

6. Remote access to the database using client software

Download Pgadmin III, start the program, click "Start"-"Add Server", enter the host, user name, password and other information, you can manage the database

Install, configure PostgreSQL9.1 on Ubuntu12.04

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.