I'm going to show you a quick tool that you can continue using through out the rest of the course or you can just know it's there and stop using it. Some people and need and love it, some people (like me) got used to using the command line (psql) and don't use it as much.
I speak of pgAdmin. Very similar to phpMyAdmin for MySQL, it exposes a GUI to interact with a PostgreSQL database. Again, I'm not super familiar with its workings but I can help you get it running and you can toy with it a bit.
In your app that you cloned, there is a Docker Compose file that you can use to get PostgreSQL spun up with pgAdmin.
In the root directory of your sql-apps directory, run the following:
Note that the following will download the pgAdmin container, about ~400MB in size.
You also may need to
docker kill sql
since they'll both try to listen on port5432
.
docker compose up
After you see the PostgreSQL database start up then the pgAdmin container start up, try going to localhost:1234. From there log in with admin@example.com
and example
.
Once in the menu, follow these instructions:
Click "Add New Server".
Add a name. You can call it whatever you want, it's just internal to pgAdmin. I called mine db. After that, click connection.
Here you need to
- Put
db
ad the hostname/address (as this is what Docker Compose is exposing the host as to the pgAdmin container) - Put port as
5432
- Leave maintenance database as
postgres
- Put username as
postgres
- Put password as
lol
- Save password
- Click save
If save is grayed out, you likely didn't add a name on the General tab.
From here you can click around the pgAdmin page and see what you can do. Maybe start by writing some queries by using the Tools > Query Tool.