Programming/PostgreSQL/Databases: Difference between revisions

From Dev Wiki
Jump to navigation Jump to search
(Create page)
 
(No difference)

Revision as of 00:28, 3 November 2020

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>;