Homebrew installs PostgreSQL. We link psql, start the database, and create a postgres user and a practice database.
Jo video mein bola, yahan nukte mein likha hai.
What I said in the video, written here as key points.

Yahan hamara data rehta hai. This is where our data will live.
PostgreSQL is the database engine, the place where your data lives. Homebrew installs it, and we set up two more things: a user called postgres and an empty database called practice, so the same connection details work on every computer in this course.
Link zaroori hai. Linking puts psql on your PATH.
Install PostgreSQL:
brew install postgresql
Homebrew installs it as postgresql@<version> and says it is keg-only, which means psql is not on your PATH yet. Link it, using the version number Homebrew printed:
brew link --force postgresql@<version>
Then open a new Terminal window and check psql --version.
The database is a background service. Starting it keeps it running.
Start the database as a background service, so it also starts when you log in:
brew services start postgresql@<version> psql --version
You should see a version number.
Yeh user hum khud banate hain. Homebrew does not create it, so we do.
Homebrew makes a super user named after your Mac account, not postgres. Our course, and pgAdmin, use postgres, so we create it:
createuser -s postgres psql -d postgres -c "ALTER ROLE postgres WITH PASSWORD 'postgres';" createdb -O postgres practice
The first line makes the user, the second gives it the password postgres (fine for practice on your own Mac), and the third makes the empty practice database.
See practice=#? You are connected. Mubarak ho!
Type:
psql -h localhost -U postgres -d practice
Enter postgres as the password. If you see practice=#, you are connected. Type \q to leave.
psql: command not found | Run brew link --force postgresql@<version>, then open a new Terminal window. |
role "postgres" does not exist | Run createuser -s postgres (step 3). |
| PostgreSQL will not start | brew services restart postgresql@<version> |
| Connection refused | Check it is running: brew services list. |
Tell me exactly what the screen says. Ghabrana nahi.
psql: command not found: run brew link --force postgresql@<version>, then open a new Terminal window.role "postgres" does not exist: run createuser -s postgres.brew services restart postgresql@<version>.brew services list.Tell me in the comments. Milte hain agli video mein. Next: install pgAdmin 4.
Free SQL course and the Setup page, which maps every step. Join the WhatsApp Community, the Channel or Discord.