I was reading Choose FI: Your Blueprint to Financial Independence and one of the chapters concluded with a question like:
“What would you do if you didn’t have to work?”
Something rose to the surface. Even if I didn’t need to work to earn money, I would still practice data analysis using SQL.
This awakened my desire to set up a SQL server-database for personal use. Back-end database access where I can write queries. I miss this dearly from my previous job, where I had an in-house electronic record system and superuser access. I’ve tasted the forbidden fruit and cannot go back to measly front-end, web-browser button clicking to configure reports with limited functionality and flexibility. The power of back-end querying is what I seek, but this is challenging when my company doesn’t currently have a database. Setting one up is notoriously hard, even for professional developers.
I emerged through some struggles to set up a personal SQL database so I can practice queries with my own data. I like the IDE called Datagrip by Jetbrains (free with a student email address) and PostgreSQL (also free) which is what I used in the previous job. Here’s how to set it up.
Step 1: Download PostgreSQL
Step 2: Install PostgreSQL and set up postgres User Password and Port.
The super user credential will be used to set up the database connection in the IDE.
Username is postgres (by default). You define the Password.
The default port of 5432 worked for me and should work for most people.
Step 3: Complete PostgreSQL Installation. Restart computer to apply downloaded updates.
Step 4: Download and set up DataGrip.
It’s free with a student email account. There are other free IDEs such as DBeaver too.
Step 5: Set up the database in DataGrip.
In the “Database” pane on top left, click the + icon > new Data Source > PostgreSQL.
Give it a name. I called it Personal Postgres.
Use localhost, port 5432, and Authentication type as User & Password.
Enter the User: Postgres and the Password you defined in step 2. Choose your Save password preference (Forever is convenient for a personal computer).
Test the connection. If it works, then hit Apply and OK.
Note: If you get an error message like this, that means the PostgreSQL was not installed correctly (step 2).
You MUST use the username and password. The “No Auth” feature did not work for me.
Step 6: Savor the connection!
The database will take a few minutes to connect to an online server so that you can use PostgreSQL SQL functions. If you have very strict firewall settings on your computer, you might need to allow Windows firewall or similar to allow the 5432 port connection.
If everything is good, you’ll get a small Connected status update on the bottom right Event Log:
In a future post, I’ll share how to upload your first database table from a CSV file.