PostgreSQL

From Dogtag
Revision as of 21:56, 13 January 2020 by Edewata (talk | contribs) (Listing Tables)

Jump to: navigation, search

Installation

To install PostgreSQL client:

$ dnf install postgresql

To install PostgreSQL server:

$ dnf install postgresql-server

Initializing Database

$ postgresql-setup --initdb --unit postgresql
$ systemctl start postgresql

Connecting to Database

To connect to a local database:

$ sudo -u postgres psql

To connect to a remote database:

$ psql postgres://<username>:<password>@<hostname>:<port>/<database>

Listing Databases

psql> \l

Listing Tables

psql> \dt

Describing a Table

psql> \d <name>

See Also