Setup Steps
1. Install PostgreSQL:
sudo apt update
sudo apt install postgresql postgresql-contrib -y2. Start the service:
sudo systemctl start postgresql
sudo systemctl enable postgresql3. Switch to PostgreSQL user:
sudo -u postgres psql4. Create a new user and database:
CREATE USER appuser WITH PASSWORD 'StrongPass123!';
CREATE DATABASE myapp OWNER appuser;
GRANT ALL PRIVILEGES ON DATABASE myapp TO appuser;
\q5. Connect to the database:
psql -U appuser -d myapp -h localhost6. Enable remote connections:
sudo nano /etc/postgresql/16/main/postgresql.conf
# listen_addresses = '*'7. Edit pg_hba.conf:
sudo nano /etc/postgresql/16/main/pg_hba.conf
# host all all 0.0.0.0/0 md58. Restart the service:
sudo systemctl restart postgresql9. Backup:
pg_dump -U appuser myapp > backup.sqlRelated Guides
MySQL Database Setup
Install MySQL database server, secure it and learn basic operations.
MongoDB Setup
Install MongoDB NoSQL database and learn basic CRUD operations.
Redis Setup
Install Redis in-memory data store. Caching and session management.
Prisma ORM Setup
Add Prisma ORM to your Node.js project. Schema definition, migration and CRUD operations.