MySQL is a program that stores data and answers questions about it. You put information into it (customers, products, blog posts), and later you ask for exactly the part you need: “the ten newest posts”, “all orders from Pune”, “the total sales this month”.
Think of a very organised filing cabinet with a very fast clerk. You hand over a request in a small language called SQL, and the clerk finds, adds, changes or removes the right records.
A first taste
This is a complete SQL request. It asks MySQL to calculate something and show the answer.
SELECT 'Hello from MySQL' AS message;
+------------------+
| message |
+------------------+
| Hello from MySQL |
+------------------+
1 row in set
You wrote a request, and MySQL replied with a small table: one column called message and one row.
What MySQL is used for
- Websites. WordPress, WooCommerce, Drupal and most PHP applications keep their posts, users and orders in MySQL.
- Web and mobile apps. An app’s server asks MySQL for data and sends the result to the app.
- Reports. Teams ask MySQL questions such as “how many sign-ups did we get each week?”.
Why people choose it
- Free and open source. The Community Edition costs nothing.
- Mature and widely supported. Almost every hosting company offers it, and almost every programming language can talk to it.
- Fast for typical web workloads. It handles reads and writes from many users at the same time.
- Reliable. With the default storage engine (InnoDB) it supports transactions, which keep your data correct even when something fails halfway.
What MySQL is not
- It is not a spreadsheet. You do not click cells. You write SQL.
- It is not a programming language for building pages. It stores and retrieves data. Another language, such as PHP, JavaScript (Node.js), Python or Java, talks to it.
- It is not the only database. PostgreSQL, SQLite, SQL Server and Oracle do similar jobs. The ideas you learn here carry over to them.