DEV Community

caglarcercinlidev
caglarcercinlidev

Posted on

HOW TO CREATE A POSTGRESQL DATABASE ON UBUNTU 20.04

Image description

First open terminal and

sudo apt update
sudo apt install postgresql postgresql-contrib

now you have downloaded necessary libraries. After that:

sudo -i -u postgres

This way you are switched to postgres user. and enter your password (of the previous user)

psql

With psql you are ready to perform postgres commands.

always use

\q

to leave postgres command line.

Finally, to create a database:

CREATE DATABASE exampledatabase;

Wish you an easy coding!

Top comments (0)