Miscellanies The PostgreSQL command line uses

Source: Internet
Author: User
Tags psql

About the use of PostgreSQL
Platform: Ubuntu 12.04 & 14.04
Version: PostgreSQL 9.3.4

PostgreSQL installation

See website installation process

Add user

After initial installation, a database named Postgres and a database user named Postgres are generated by default. It is important to note that a Linux system user named Postgres is also generated.

Of course, other users can also be generated.

Start using
    1. Switch to Postgres user login

      $ sudo su-postgres

    2. PostgreSQL built-in commands
      PostgreSQL comes with two system commands: createuser with createdb , you can create users and databases with these two commands, respectively.

    3. Using the Psql command

      $ psql db_name

      The PostgreSQL console can be accessed via the above command, as in MySQL.
      Interface such as: db_name:#

    4. Simple use of commands

      1. To list all databases:\l
      2. List all the tables:\d
      3. Exit:\q
      4. Help:\?
      5. Execute the SQL command, directly typing the command execution (note the last face plus ; ).

Miscellanies The PostgreSQL command line uses

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.