Programming/PostgreSQL/Databases

From Dev Wiki
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>;