Log in to the PostgreSQL database console
Login successful Display
[zpf@kevin ~]$ psql postgrespsql (9.4.1)Type"help"for help.postgres=#
Create DATABASE User xxx
CREATE USER xxx WITH PASSWORD ‘xxxxxx‘;
Create a database yyy and specify all of them as xxx
CREATE DATABASE yyy OWNER xxx;
To the database yyy all operation permissions assigned to the user xxx, otherwise xxx can only login to the console, no matter what the database operation rights
GRANT ALL PRIVILEGES ON DATABASE yyy to xxx;
Delete Database yyy
Delete User xxx
Exit Psql Console
Use other commands frequently
\h: View the explanation of the SQL command, such as \h select.
\?
: View the list of psql commands.
\l: List all databases.
\c [database_name]: Connect to other databases.
\d: List all tables in the current database.
\d [table_name]: Lists the structure of a table.
\du: List all users.
\e: Open the text editor.
\conninfo: Lists information about the current database and connections.
\password uesrname : Change the database user password.
Note: The primary database operation must be uppercase. such as create. Select and so on.
PostgreSQL Database psql Console action command