Chapter 1: Introduction to MySQL
Introduction to MySQL
Come, sit comfortably! Today we’re starting our MySQL journey from the very beginning. I’ll explain everything slowly, with real-life examples, just like I would in a classroom. No rush, no jargon bombing — only clear understanding.
1. What exactly is MySQL? (In very simple words)
Imagine you own a small kirana (grocery) shop.
Every day you sell many items: rice, dal, soap, biscuits, etc. You need to remember:
- Which items you have in stock
- How many packets of each
- How much you paid the supplier
- How much you sold them for
- Who are your regular customers
- Which customers still owe you money
If you try to keep all this in your head or in 100 different notebooks, you will go mad!
MySQL is like a super-smart, super-organized digital notebook (actually a full software system) that helps you store all this information in an extremely organized way — in tables — and lets you find any information in seconds, even if you have lakhs of records.
Official definition (but in human language):
MySQL is a free and open-source Relational Database Management System (RDBMS).
- Relational → Data is stored in tables that can be connected/related to each other (like linking “Customers” table with “Orders” table).
- Database Management System → It’s the software that actually manages (stores, retrieves, updates, deletes, secures) all your data.
- Open-source → Anyone can download it for free, see its code, modify it, and even sell services around it.
Real-life example companies using MySQL right now (2026):
- Facebook / Meta (billions of users)
- YouTube (every comment, like, view is stored in MySQL originally)
- Twitter / X (used MySQL heavily in early days)
- Netflix, Spotify, Uber, Airbnb
- Almost 50% of all websites on the internet (WordPress, Joomla, Drupal, Magento) run on MySQL!
2. History of MySQL (just enough to feel proud when someone asks)
- 1995 → Two Swedish guys, Michael “Monty” Widenius and David Axmark, created MySQL while working for a company called TCX DataKonsult AB.
- They named it MySQL → My (Monty’s daughter’s name) + SQL.
- It became super popular very fast because it was fast, free, and easy.
- 2008 → Sun Microsystems bought MySQL for ~$1 billion.
- 2010 → Oracle bought Sun → so Oracle now owns MySQL.
- Monty and some original developers were not happy with Oracle’s direction → they created a fork called MariaDB (Maria is Monty’s younger daughter’s name!).
- Today (2026): Both MySQL (by Oracle) and MariaDB (community-driven) are extremely popular. MySQL 8.4 is the current LTS (Long Term Support) version.
3. Key Features of MySQL (Why it became so loved)
- Very very fast – especially for reading data (web apps love this)
- Free forever (Community Edition)
- Easy to install and learn
- Works on Windows, Linux, macOS
- Huge community – millions of tutorials, answers on Stack Overflow
- Very reliable – when using InnoDB storage engine (default since MySQL 5.5)
- Scales beautifully – from a small laptop to thousands of servers (Facebook does this!)
- Modern features (in MySQL 8+):
- JSON support
- Window functions (like RANK(), ROW_NUMBER())
- Common Table Expressions (WITH clause)
- Better full-text search
- Role-based security
4. SQL vs MySQL – The Confusion Cleared Forever!
| Question | SQL | MySQL |
|---|---|---|
| What is it? | A language | A software / database server |
| Full form | Structured Query Language | My + SQL (brand name) |
| Purpose | The way we “talk” to databases | The actual program that understands SQL |
| Example | Like Hindi language | Like a person who speaks Hindi |
| Who else uses it? | PostgreSQL, Oracle, SQL Server, SQLite, MariaDB, etc. | Only MySQL (and MariaDB is very similar) |
| Do you install it? | No – you learn it | Yes – you download and install MySQL |
Real-life analogy:
- SQL = English language
- MySQL = A friend who speaks English and keeps all your data for you
You use SQL sentences to give orders to MySQL.
Example:
|
0 1 2 3 4 5 6 |
SELECT name, phone FROM customers WHERE city = 'Mumbai'; |
This is SQL language. MySQL is the one who actually goes and finds all customers from Mumbai and shows you their name & phone.
5. Why do people still love MySQL so much in 2026?
- Popularity → Still in top 3 databases worldwide (DB-Engines ranking)
- Performance → Blazing fast for web applications
- Scalability → Can handle millions of queries per second (YouTube, Facebook did it)
- Ecosystem → Works perfectly with PHP, Python (Django/Flask), Node.js, Java, .NET, etc.
- Free & open → No license fees (unlike Oracle or SQL Server Enterprise)
- Cloud ready → AWS RDS, Google Cloud SQL, Azure MySQL, DigitalOcean, etc.
6. How to Install MySQL on Your Laptop (3 Easy Ways – 2026)
Way 1: Official MySQL (Best for serious learning)
- Go to → https://dev.mysql.com/downloads/
- Download MySQL Installer for Windows (or macOS package / Linux repo)
- Run installer → Choose Developer Default (includes Server + Workbench + Shell)
- Set a strong root password (remember it!)
- Finish → You now have:
- MySQL Server
- MySQL Workbench (beautiful GUI tool – like VS Code for databases)
Way 2: XAMPP (Super beginner-friendly – especially for web developers)
- Download from → https://www.apachefriends.org/
- Install → It includes:
- Apache (web server)
- MySQL (actually MariaDB – 100% compatible)
- PHP
- phpMyAdmin (browser-based tool)
- Start XAMPP Control Panel → Click Start on MySQL
- Open browser → http://localhost/phpmyadmin → ready!
Way 3: For macOS lovers Use MAMP (similar to XAMPP) or Homebrew:
|
0 1 2 3 4 5 6 |
brew install mysql |
7. Connecting to MySQL for the First Time (Hands-on!)
Method 1: Command Line (most powerful way)
Windows / macOS / Linux → Open terminal / command prompt and type:
|
0 1 2 3 4 5 6 |
mysql -u root -p |
- -u root → username is root (default super admin)
- -p → will ask for password
Enter the password you set during installation.
If successful, you will see:
|
0 1 2 3 4 5 6 |
mysql> |
Now you are inside MySQL! 🎉
Try these commands:
|
0 1 2 3 4 5 6 7 8 9 10 |
SHOW DATABASES; -- See all databases CREATE DATABASE college; -- Create your first database USE college; -- Switch to it SHOW TABLES; -- (empty right now) EXIT; -- Come out |
Method 2: MySQL Workbench (GUI – very beautiful)
- Open MySQL Workbench
- Click Local instance MySQL80 (or new connection)
- Hostname: 127.0.0.1 or localhost
- Port: 3306 (default)
- Username: root
- Password: (the one you set)
- Click Test Connection → if green → Connect!
You’ll get a nice interface to write queries, see tables visually, design ER diagrams, etc.
That’s it for Chapter 1! You now know:
- What MySQL really is
- Its history
- Why it’s still king
- How to install it
- How to connect to it
Homework for today (very important!) Install MySQL on your laptop using any method above. Open the command line or Workbench. Run SHOW DATABASES; and tell me what you see. (Just write the output here — we’ll continue from there!)
