After installation we need to login to postgresql to create database, roles, schemas etc
When postgresql11 is installed, there is a default superuser postgres created, which does not have any password. We just login to the database using this superuser
sudo -i -u postgres
Now we can enter into psql, which is the database commandline
psql (11.2 (Ubuntu 11.2-1.pgdg18.04+1))
Type "help" for help.
Now in the command line of psql, we create a database
create database testdb;
To see the list of databases installed:
To quit psql type
Now we create another superuser other than postgres
postgres@ana-pg:~$ createuser --interactive
Enter name of role to add: rtam
Shall the new role be a superuser? (y/n) y
postgres@ana-pg:~$ alter user rtam with password 'partha';
With this new superuser rtam one can add a new server in pgAdmin4. Here we just need to click on “Add New Server”. Then name the server anything. Under Connections Tab, hostname is localhost.
The username and password are that of the new user we created rtam
The Add New Server will not work with user as postgres, because postgres is created by default in Ubuntu without a password. Now one can see in pgAdmin4 that the database testdb has been created.