PostgreSQL Installation and settings

I grant all permission for user as asked in task but still get errore:

PostgreSQL is not configured correctly, either user ‘kodekloud_tim’ and database ‘kodekloud_db6’ does not exist or user ‘kodekloud_tim’ does not has appropriate permissions on database ‘kodekloud_db6’ on DB Server

Also from Terminal
peter@stdb01 ~]$ sudo -u postgres psql
could not change directory to “/home/peter”: Permission denied
psql (12.2)
Type “help” for help.

postgres=# postgres=# create database mydb;
ERROR: syntax error at or near “postgres”
LINE 1: postgres=# create database mydb;
^
postgres=# postgres=# create database kodekloud_db6;
ERROR: syntax error at or near “postgres”
LINE 1: postgres=# create database kodekloud_db6;
^
postgres=# create database kodekloud_db6;
CREATE DATABASE
postgres=# create user kodekloud_tim with encrypted password ‘BruCStnMT5’;
CREATE ROLE
postgres=# grant all privileges on database kodekloud_db6 to kodekloud_tim;
GRANT
postgres=# exit
[peter@stdb01 ~] sudo vi /var/lib/pgsql/12/data/pg_hba.conf [sudo] password for peter: [peter@stdb01 ~] thor@jump_host /$

What was the question? and What configuration did you exactly do in the pg_hba.conf file?