What Is MySQL
Introduction
MySQL is one of the most widely used relational database management systems (RDBMS) in the world. It stores structured data in tables, answers questions with SQL, and powers everything from personal blogs to large e-commerce platforms. This chapter explains core database concepts, how MySQL compares to alternatives, and where this tutorial fits on Hello Code.
Prerequisites
- Basic comfort with files and a terminal
- No database installed yet for this overview
- Helpful: any backend tutorial (Java, JavaScript, Spring Boot)
Relational Data in One Picture
Database: shop
├── Table: users (rows = one user each)
├── Table: products
└── Table: orders (links users to products)| Concept | Meaning |
|---|---|
| Database | Named container for related tables |
| Table | Grid of rows and columns |
| Row (record) | One entity—a user, an order line |
| Column (field) | One attribute—email, price, created_at |
| Primary key | Unique identifier for each row |
| Foreign key | Column pointing to another table's key |
Code explanation:
- Relational means tables connect through keys—you avoid duplicating user name on every order row
- SQL (Structured Query Language) is how you create tables and read/write data
What MySQL Does
MySQL server process listens for connections (default port 3306), executes SQL, enforces constraints, and persists data to disk. You connect with a client—command-line mysql, MySQL Workbench, DBeaver, or your app via JDBC.
Typical flow:
Your app / mysql client MySQL Server
│ │
│ SELECT * FROM users │
├─────────────────────────────►│
│◄─────────────────────────────┤ rowsMySQL vs MariaDB vs PostgreSQL
| MySQL | MariaDB | PostgreSQL | |
|---|---|---|---|
| Origin | Oracle-owned open core | MySQL fork | Independent OSS |
| Common use | Web LAMP/Node/Java stacks | Drop-in MySQL replacement | Complex queries, GIS, strict SQL |
| Hello Code focus | This track | Compatible for most tutorials | PostgreSQL track |
Choose MySQL 8.0+ when following this site—matches JDBC MySQL install and Spring Boot defaults.
MySQL vs MongoDB vs Redis
| Store | Model | Best for |
|---|---|---|
| MySQL | Tables, rows, SQL, foreign keys | Billing, orders, reports, strict relationships |
| MongoDB | BSON documents, flexible schema | Nested content, catalogs, event logs |
| Redis | In-memory keys, TTL | Cache, sessions, rate limits, queues |
Many products use all three: MySQL as source of truth for transactions, MongoDB for document-shaped data, Redis for hot reads—see MongoDB performance and project deploy.
Tip
Pick by access pattern
If you need JOINs and ACID reports, start here. If documents change shape often, read Embedded vs Referenced for the document-model equivalent of foreign keys.
Version Highlights: 5.7 vs 8.0
| Topic | MySQL 8.0 (recommended) |
|---|---|
| Default charset | utf8mb4 (full Unicode including emoji) |
| Authentication | caching_sha2_password default |
| SQL features | Window functions, better JSON, CHECK constraints |
| Removed | Query cache (was often misleading) |
New projects should install 8.0 or newer—not 5.7 unless legacy requirement.
Typical Use Cases
- Web backends — user accounts, posts, sessions
- Content systems — WordPress-style CMS data
- Analytics — aggregated reports with SQL
- Learning SQL — skills transfer to PostgreSQL, SQL Server
Pairs with:
| Track | Connection |
|---|---|
| JDBC | Java apps connecting to MySQL |
| Spring Boot | JPA/Hibernate with MySQL |
| Linux | Server install and systemd |
| Git | Schema migrations in version control |
| MongoDB | Document store when schema varies by record |
| PostgreSQL | Sister SQL track—JSONB, MVCC, advanced SQL |
| Redis | Cache layer in front of MySQL |
| Vue | SPA frontend—pair with FastAPI or Django REST + blog reader project |
A Minimal SQL Preview
After install you will run:
-- Create a database and table
CREATE DATABASE demo CHARACTER SET utf8mb4;
USE demo;
CREATE TABLE greeting (
id INT PRIMARY KEY AUTO_INCREMENT,
message VARCHAR(100) NOT NULL
);
-- Insert and query
INSERT INTO greeting (message) VALUES ('Hello MySQL');
SELECT * FROM greeting;Code explanation:
- Comments start with
-- AUTO_INCREMENTgenerates id values automatically- Semicolon
;ends a statement in the mysql client
Tutorial Roadmap
- Install on your OS (or Docker)
- Databases, tables, CRUD
- Joins, aggregates, indexes
- Transactions, views, procedures
- Backup, security, performance
- Blog and e-commerce schema projects
Tip
Learn SQL Here, Connect in App Tracks
Master tables and queries in this MySQL track; wire the same database into Java or Node in JDBC/Spring chapters.
FAQ
MySQL free?
Community edition is free and open source; commercial features exist for enterprise—learning uses Community.
Do I need Workbench?
No—CLI mysql is enough; GUI tools help visualization.
SQLite instead?
SQLite is file-based and great for embedded apps; MySQL teaches client/server skills for production web stacks.
MariaDB instead of MySQL?
Most beginner SQL transfers; install chapter differs slightly.
Cloud MySQL?
AWS RDS, PlanetScale, etc.—same SQL; connection host changes.
Where is data stored?
Server data directory (OS-specific)—covered in install chapters.
MySQL vs MongoDB?
MySQL enforces table schema and JOINs; MongoDB stores flexible documents—see What Is MongoDB. Use both when transactions live in SQL and content/logs live in documents.