PostgreSQL CLI (psql) Commands …
https://kontext.tech/article/637/postgresql-cli-psql-commands
PostgreSQL CLI (psql) Commands psql -U postgres -W -p 5432 -h localhost: Connect to a PostgreSQL server with username, password, port, and host. \l: List all databases. \c database_name: Switch to another database. \dt: List database tables. \d table_name: Describe a table. \dn: List all schemas. \du: List users and their roles. SELECT * FROM table_name;: Run a simple query. Connect to psql The following commands connects to PostgreSQL server via psql command: psql -U postgres -W -p 5432 -h localhost ... Show databases \l ... 1. Connect to a database - psql -d The first step involves learning how to connect to a database. ... 2. List all databases - \l ...
psql -U postgres -W -p 5432 -h localhost: Connect to a PostgreSQL server with username, password, port, and host.
\l: List all databases.
\c database_name: Switch to another database.
\dt: List database tables.
\d table_name: Describe a table.
\dn: List all schemas.
\du: List users and their roles.
SELECT * FROM table_name;: Run a simple query.
Connect to psql The following commands connects to PostgreSQL server via psql command: psql -U postgres -W -p 5432 -h localhost ...
Show databases \l ...
1. Connect to a database - psql -d The first step involves learning how to connect to a database. ...
2. List all databases - \l ...
DA: 83 PA: 48 MOZ Rank: 31