Programming/PostgreSQL/Databases

From Dev Wiki
< Programming‎ | PostgreSQL
Revision as of 00:27, 3 November 2020 by Brodriguez (talk | contribs) (Create page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Creating a New Database

Via Linux Shell

From the PostgreSQL shell:

CREATEDB <database_name>;

Via PostgreSQL Shell

CREATE DATABASE <database_name>;

Deleting a Database

DROP DATABASE <database_name>;

Show All Databases

From the PostgreSQL shell:

\l

Load Database

\c <database_name>

Give Database Privileges to User

From the PostgreSQL shell:

GRANT ALL PRIVILEGES ON DATABASE <database_name> TO <user_name>;