A Database Connection Is Just Five Coordinates
Every database connection (Postgres, MySQL, Mongo) is the same five pieces: host, port, user, password, database. Learn the model, and every CLI flag maps to one of them.
Any database connection (Postgres, MySQL, Mongo, anything) is the same five pieces. Mental model: address + keys.
A connection
│
├─ address: host (which machine) + port (which door) + database (which DB)
└─ keys: user (who am I) + password (prove it)
| # | Coordinate | Answers |
|---|---|---|
| 1 | host | which machine? |
| 2 | port | which door on it? |
| 3 | user | who am I? |
| 4 | password | prove it |
| 5 | database | which DB on that server? |
There is no sixth thing. Every confusing CLI flag maps to exactly one of these. Learn the five, and every DB tool collapses into one model. Only the spelling of the flags changes.
From this session: confusion over “-h -d -pwd -user or whatever” across psql / mysql / mongo dissolved once we named the fixed five-coordinate set behind all of them.
Every DB tool is the same five-coordinate model with a different spelling: memorize the model, not the flags.
References
- PostgreSQL libpq connection: https://www.postgresql.org/docs/current/libpq-connect.html
Related: back to the remote DB overview, then on to the connection URI and the MySQL CLI flags.