Day 17/100 of DevOps
Day 17: Set Up PostgreSQL Database for the Nautilus App
Task: PostgreSQL database server is already installed on the Nautilus database server.
a. Create a database user kodekloud_cap and set its password to YchZHRcLkL.
b. Create a database kodekloud_db6 and grant full permissions to user kodekloud_cap on this database.
Note: Please do not try to restart PostgreSQL server service.
This challenge focuses on setting up a PostgreSQL database, specifically creating a dedicated user, a new database, and granting that user full permissions, preparing the environment for an application without restarting the service.
Step by Step Process:
Login to the Database server
ssh peter@stdb01
Switch to the postgres system user
On most Linux servers, PostgreSQL is managed by the postgres OS user. Run:
sudo su - postgres
Access the PostgreSQL Interactive Shell
psqlThis gave me access to the PostgreSQL command interface where I could safely run SQL statements.

Create the User
I created the user and assigned the password:
postgres=# CREATE USER kodekloud_cap WITH PASSWORD 'YchZHRcLkL';
Create the Database
postgres=# CREATE DATABASE kodekloud_db6;
Grant Privileges
Granting full access to the user on the newly created database:
postgres=# GRANT ALL PRIVILEGES ON DATABASE kodekloud_db6 TO kodekloud_cap
Exit PostgreSQL and Postgres User
exit
And the database environment was fully set up, without touching the service status or configuration files.