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