Check the PostgreSQL database installation under Linux system, log in database and simple view database

Source: Internet
Author: User
Tags postgresql psql

1. Check whether the Linux system installs the database

First see if your system has the PostgreSQL database command installed as follows: Rpm-qa | grep PostgreSQL

If the query results are not displayed (as shown), the PostgreSQL database is not installed

2. Log in to the database

Enter the command su postgres and then enter the command Psql, as shown in the result

This is equivalent to the system user Postgres with the same name as the database user, log in to the database, this is not input password. If all goes well, the system prompt changes to "postgres=#", which means that the database console is now in.

3. Create a database, first we look at the database in the system

Create database The name is AA database Creation command is CREATE DATABASE AA;

In, we see the AA database, and then there are its owners, character encodings, varsity rules, and access rights.

4. Appendix

    • \h: View an explanation of the SQL command, such as \h Select.
    • \?: View the list of PSQL commands.
    • \l: Lists all databases.
    • \c [database_name]: Connect to a different database.
    • \d: Lists all tables for the current database.
    • \d [table_name]: Lists the structure of a table.
    • \DU: Lists all users.
    • \e: Opens a text editor.
    • \conninfo: Lists the current database and connection information.

Check the PostgreSQL database installation under Linux system, log in database and simple view database

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.