SQL Tutorial 0/85 lessons ~6 min read Lesson 6

    Installing PostgreSQL / MySQL

    To learn SQL the right way you need a real database on your machine.

    Course progress0%
    Focus
    6 guided sections
    Practice signal
    Examples included
    Career prep
    Foundation builder

    Introduction

    To learn SQL the right way you need a real database on your machine. We recommend PostgreSQL — it is open source, ACID-compliant and used by serious companies. MySQL is the second most popular and equally valid for learning.

    Beginner analogy: installing a database is like installing a kitchen. You only do it once, then you cook (query) for years.

    Understanding the topic

    Core concepts to understand:

    • Mac: brew install postgresql@16 then brew services start.
    • Windows: download the EnterpriseDB installer → run pgAdmin.
    • Linux: sudo apt install postgresql.
    • MySQL: brew install mysql or use Docker.
    • Use Docker for a clean, disposable setup: docker run -e POSTGRES_PASSWORD=pw postgres.

    Syntax reference

    Visual workflow / architecture:

    bash
    Local Machine
    ├── postgres (port 5432)
    │ └── psql / pgAdmin / DBeaver
    └── mysql (port 3306)
    └── mysql CLI / Workbench / DBeaver
    Docker: postgres:16 → -p 5432:5432 → client tools

    Real-world use

    Most companies run Postgres or MySQL inside Docker locally and on managed services like AWS RDS, Google Cloud SQL or Supabase in production.

    Best practices

    • Use Docker locally so you can wipe and restart anytime.
    • Install DBeaver as a free GUI client.
    • Set a strong password from day one — habits matter.

    Hands-on exercise

    Interview preparation — practice these questions:

    • Q1. Default port of Postgres? MySQL?
    • Q2. What is psql?
    • Q3. Why use Docker for local databases?
    • Q4. Difference between server and client tools.
    • Q5. What is a managed database service?
    Ready to mark this lesson complete?Track your journey across the entire course.