The Nautilus application development team has shared that they are planning to deploy one newly developed application on Nautilus infra in Stratos DC. The application uses PostgreSQL database, so as a pre-requisite we need to set up PostgreSQL database server as per requirements shared below:
PostgreSQL database server is already installed on the Nautilus database server.
a. Create a database user kodekloud_pop and set its password to BruCStnMT5.
b. Create a database kodekloud_db7 and grant full permissions to user kodekloud_pop on this database.
Note: Please do not try to restart PostgreSQL server service.
Listing the Existing Users
This need sudo access
1
2
3
4
[peter@stdb01 ~]$ cat /etc/passwd
# Other User Name
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
# Other User name
Login as postgre
As we saw the postgres user have direct shell access to psql. We switch existing user to postgres.With that user psql shell can be access
1
2
3
4
5
[peter@stdb01 ~]$ sudo su - postgres
[postgres@stdb01 ~]$ psql
psql (13.14)
Type "help" for help.
Create user from postgres
According to requirement
- Create user
- Create database
- Create Grant access to created user.
1
2
3
4
5
6
7
8
9
10
postgres=# CREATE USER kodekloud_pop WITH PASSWORD 'BruCStnMT5';
CREATE ROLE
postgres=# CREATE DATABASE kodekloud_db7;
CREATE DATABASE
postgres=# /l
postgres-# /d
postgres-# \d
Did not find any relations.
postgres-# GRANT ALL PRIVILEGES ON DATABASE kodekloud_db10 TO kodekloud_pop;
Thats all for today! Thx Bye