Remember the problem from last lesson? Our users lived in an array, and restarting the server wiped them. A database is memory that survives.
MySQL is the database; DBngin is how we run it without wanting to throw the laptop out the window.
What is DBngin?
DBngin is a free little app that runs MySQL, PostgreSQL and Redis locally with one click. Normally, installing a database server means services, config files and a lot of swearing. DBngin turns that into: press start.
Set it up
- 1
Download DBngin
Go to dbngin.com and download it. It's free and built by the folks behind TablePlus, for Windows and Mac.
https://dbngin.comNo account needed. Yes, that's still allowed on the internet.
- 2
Install and open it
Standard install. Open the app — you'll see an empty list of database servers.
- 3
Create a MySQL instance
Click the plus button, choose MySQL, and keep the defaults. Note the port: 3306 is the MySQL standard.
Type: MySQL Port: 3306 Version: default (8.x) - 4
Press Start
That's genuinely it. When the dot goes green, a real MySQL server is running on your machine at 127.0.0.1:3306.
- 5
Take a look inside (optional)
Install TablePlus — the free tier is plenty — and connect with host 127.0.0.1, port 3306, user root, empty password. This is how you'll peek at rows later.
Host: 127.0.0.1 Port: 3306 User: root Password: (empty)
Designing the users table
A database stores data in tables — rows and columns, like a spreadsheet that got serious. Our API only needs one table for now:
| Column | Type | Rules |
|---|---|---|
id |
INT |
primary key, auto increment |
name |
VARCHAR(255) |
not null |
email |
VARCHAR(255) |
not null, unique |
And here it is as SQL:
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE
);
Read it line by line:
INT AUTO_INCREMENT— an integer that fills itself in: 1, 2, 3… You never choose an id, MySQL does.PRIMARY KEY— the row’s unique identity. It’s how a row can be found at all.VARCHAR(255)— text, up to 255 characters.NOT NULL— this field can’t be empty. The database enforces it, not just our code.UNIQUE— no two rows can share an email. Insert a duplicate and MySQL refuses.
You don’t have to create the database by hand
Here’s a nice detail: the next lesson’s code creates demo_db automatically — it connects to MySQL and runs CREATE DATABASE IF NOT EXISTS. You don’t click anything.
Columns and the table? The code creates those too. We designed the schema here so that when you read the code, every line is already familiar.
Recap
DBngin runs MySQL locally with one click — no server setup ritual.
Local defaults: host 127.0.0.1, port 3306, user root, empty password.
Tables are rows and columns; rules live on the columns.
id is auto increment + primary key; email is unique.
The next lesson's code creates demo_db and the users table for you.
MySQL is running, the table is designed, and the credentials are noted. Next lesson: all the code, every line explained, and a real round trip you can make with your own hands.
Up next
The full code, explained
Four files, one real API. Every line of express-dbngin-api/ — the connection, the routes, the queries — and how to run it yourself.