Skip to content
IT glossary
DatabasesUpdated December 3, 2026

MySQL

It’s a relational database management system that stores data in tables and lets applications read and change that data using SQL.

What MySQL does

MySQL is a database server that applications use to store and retrieve related records. A booking app might keep customers in one table and reservations in another. Each reservation stores the ID of its customer, so the app can use a JOIN to fetch a reservation alongside the customer's name. A foreign key can enforce that the customer ID points to a real row.

MySQL is the software; SQL is the language you use to talk to it. A query written for MySQL may also work in PostgreSQL, but the two systems have different SQL dialects and defaults. Moving an application between them usually takes more than changing the connection string.

What happens when you send a query

An application connects through a database driver. MySQL parses the SQL and chooses an execution plan. For a SELECT, that can mean deciding whether to scan a table or use an index to narrow down the rows it needs to read. The table's storage engine handles the underlying data and index operations. InnoDB, the default engine in modern MySQL, supports transactions, foreign keys, and row-level locking.

A transaction is useful when changes need to succeed or fail together. A booking service might create a reservation and update availability in the same transaction. The application commits if both changes succeed and rolls back if either fails. With autocommit enabled and no explicit transaction, each successful write is committed independently.

Example: finding a customer's upcoming bookings

Suppose the app frequently shows upcoming bookings for one customer. It can filter by customer and start time, then sort the results chronologically:

SELECT id, starts_at
FROM bookings
WHERE customer_id = 42 AND starts_at >= CURRENT_TIMESTAMP
ORDER BY starts_at;

An index on (customer_id, starts_at) groups bookings by customer and orders each customer's entries by start time. This lets MySQL seek to that customer's upcoming bookings and read them in order if the optimizer chooses that plan. Reversing the column order puts bookings from all customers together by time, so MySQL may have to read more entries to find that customer's rows. Use EXPLAIN to check the chosen plan rather than assuming that an available index will be used.

Where MySQL fits and what interviewers look for

MySQL is commonly used for the day-to-day reads and writes behind web apps, content management systems, and internal tools. Read replicas can take some queries off the primary server, but an asynchronous replica may not show a write that just succeeded on the primary. Adding indexes is also a trade-off: they can make reads faster, but they take up space and add work to writes.

In interviews, expect to explain a choice: which columns belong in an index and in what order, which statements should share a transaction, or whether a request immediately after a write can safely read from a replica.