Introduction
After installing Postgresql on Ubuntu, you will need to complete a few basic setup steps.
Set the Password for the postgres User
The first step is to update the password for the postgres user.
sudo -u postgres psql postgres
Then enter the following command at the postgres=# prompt.
\password postgres
Create a Database
If you exited the postgres=# prompt, then enter the following command to connect to Postgresql. However, if your prompt still looks like postgres=#, then do not enter the psql command below.
sudo -u postgres psql postgres
Enter the following command at the postgres=# prompt.
First we’ll list all of the databases, which should be the following: postgres, template0, and template1.
\l
CREATE DATABASE practicedb;
\l
Now you should see the practicedb database.
Press Ctrl + D to exit the Postgres prompt.