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

text
Database: shop
├── Table: users          (rows = one user each)
├── Table: products
└── Table: orders         (links users to products)
ConceptMeaning
DatabaseNamed container for related tables
TableGrid of rows and columns
Row (record)One entity—a user, an order line
Column (field)One attribute—email, price, created_at
Primary keyUnique identifier for each row
Foreign keyColumn 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:

text
  Your app / mysql client          MySQL Server
        │                              │
        │  SELECT * FROM users         │
        ├─────────────────────────────►│
        │◄─────────────────────────────┤ rows

MySQL vs MariaDB vs PostgreSQL

MySQLMariaDBPostgreSQL
OriginOracle-owned open coreMySQL forkIndependent OSS
Common useWeb LAMP/Node/Java stacksDrop-in MySQL replacementComplex queries, GIS, strict SQL
Hello Code focusThis trackCompatible for most tutorialsPostgreSQL track

Choose MySQL 8.0+ when following this site—matches JDBC MySQL install and Spring Boot defaults.

MySQL vs MongoDB vs Redis

StoreModelBest for
MySQLTables, rows, SQL, foreign keysBilling, orders, reports, strict relationships
MongoDBBSON documents, flexible schemaNested content, catalogs, event logs
RedisIn-memory keys, TTLCache, 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

TopicMySQL 8.0 (recommended)
Default charsetutf8mb4 (full Unicode including emoji)
Authenticationcaching_sha2_password default
SQL featuresWindow functions, better JSON, CHECK constraints
RemovedQuery 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:

TrackConnection
JDBCJava apps connecting to MySQL
Spring BootJPA/Hibernate with MySQL
LinuxServer install and systemd
GitSchema migrations in version control
MongoDBDocument store when schema varies by record
PostgreSQLSister SQL track—JSONB, MVCC, advanced SQL
RedisCache layer in front of MySQL
VueSPA frontend—pair with FastAPI or Django REST + blog reader project

A Minimal SQL Preview

After install you will run:

sql
-- 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_INCREMENT generates id values automatically
  • Semicolon ; ends a statement in the mysql client

Tutorial Roadmap

  1. Install on your OS (or Docker)
  2. Databases, tables, CRUD
  3. Joins, aggregates, indexes
  4. Transactions, views, procedures
  5. Backup, security, performance
  6. 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.