To install and run PostgreSQL locally, we will run it in its Docker container through the following command:
docker run -d --name postgresCont -p 5432:5432 -e POSTGRES_PASSWORD=12345678 postgres- Container Name: postgresCont
- Port Mapping: Binds the container's 5432 port with the local machine's 5432 port.
- Password: Sets up the default password for the user postgres.
After running the container, execute the following command to enter the PostgreSQL shell:
docker exec -it postgresCont bashOnce inside the container run below command to enter postgres shell
psql -h localhost -U postgresAfter it run below command to create a database in our postgres database
CREATE DATABASE ip_jobs;Create a new PostgreSQL user named srrathi with an encrypted password:
CREATE USER srrathi WITH ENCRYPTED PASSWORD '12345678';Grant all privileges to the user srrathi for the ip_jobs database:
GRANT ALL PRIVILEGES ON DATABASE ip_jobs TO srrathi;Exit the PostgreSQL shell:
\qBy following these steps, you have set up a PostgreSQL database locally named ip_jobs with a user srrathi having necessary permissions.
Continue to the next steps for dumping CSV data, configuring endpoints, and creating Postman requests.