What is MySQL & MariaDB?
MySQL is a free, open-source relational database — a program that stores data in tables made of rows and columns (like a spreadsheet) and lets many users read and write that data safely at the same time. For decades it has been the most widely deployed open-source database in the world, powering everything from small WordPress blogs to huge sites like Facebook and YouTube. MariaDB is a near-identical twin of MySQL, created by the same people, that you can usually swap in without changing a single line of your application. This page explains what both are, why MariaDB exists, how compatible they really are, and where they fit before you install and administer them.
What “relational” and “SQL” mean
A relational database organises data into tables, and those tables can be linked (“related”) to each other. For example, a customers table and an orders table can be connected so each order knows which customer placed it.
You talk to the database using SQL (Structured Query Language) — a text-based language for asking questions and changing data. A simple query looks like this:
SELECT name, email FROM customers WHERE country = 'India';
The database reads that, finds the matching rows, and sends them back. SQL is a shared standard, so most of what you learn on MySQL also applies to MariaDB, PostgreSQL, and other relational databases.
Why MariaDB exists — the Oracle fork story
MySQL was created in 1995 by a Swedish company. In 2008 it was bought by Sun Microsystems, and in 2010 Oracle (a large database company that also sells expensive commercial databases) acquired Sun — and with it, MySQL.
This worried the original MySQL developers. They feared Oracle might let the free version stagnate or push people toward its paid products. So MySQL’s original creator, Michael “Monty” Widenius, took the open-source code and started a fork of it. A fork is a copy of a project’s source code that is then developed independently. He named that fork MariaDB (after his daughter Maria) to guarantee a community-controlled version would always stay free and open.
So today you have two closely related databases:
- MySQL — now developed by Oracle. The free “Community Edition” is open-source; Oracle also sells paid enterprise versions.
- MariaDB — a community-driven, fully open-source fork that started from the same code base.
Tip: On Ubuntu, when you run
apt install mysql-serveryou get Oracle’s MySQL, andapt install mariadb-servergives you MariaDB. They cannot both own the standard port at the same time, so pick one per server.
How compatible are they?
For most everyday work, MariaDB is a drop-in replacement for MySQL. The same client commands (mysql, mysqldump), the same SQL syntax, the same default port (3306), and the same connection libraries all work. An application written for MySQL will usually connect to MariaDB without any changes.
That said, the two have drifted apart over the years. They now have some features the other lacks, different storage engine defaults, and JSON handling that is implemented differently under the hood. For a beginner this rarely matters, but it is worth knowing they are no longer 100% identical.
| Factor | MySQL (Oracle) | MariaDB |
|---|---|---|
| Owner | Oracle Corporation | MariaDB Foundation / community |
| Licence | Open-source Community + paid Enterprise | Fully open-source |
| Client tools | mysql, mysqldump | Same commands (often symlinked) |
| Default port | 3306 | 3306 |
| Drop-in swap | — | Yes, for most apps |
| Common on | Oracle stacks, official MySQL setups | Many Linux distros’ default “MySQL” |
When to choose MySQL: you run software that explicitly expects Oracle’s MySQL, or your hosting/team standard is built around it.
When to choose MariaDB: you want a guaranteed-open-source database, or you are on a Linux distribution where MariaDB is the default. For a fresh personal project, either is a fine, safe choice.
Where MySQL shines — the LAMP stack
MySQL became famous as the “M” in the LAMP stack — a classic, battle-tested way to run web apps made of four pieces:
- Linux — the operating system
- Apache — the web server
- MySQL — the database
- PHP — the programming language
A huge share of the web still runs on LAMP, including most WordPress sites (WordPress is the software behind a large fraction of all websites). If your job involves hosting WordPress, an online store, or older PHP applications, MySQL or MariaDB is almost always the database underneath. It is fast, simple, well understood, and works on cheap servers — which is exactly why it is everywhere.
Where MySQL fits in a DevOps stack
On a typical Linux server, MySQL is the data layer. Your application connects to it over the network, runs SQL queries, and gets data back:
[ User's browser ]
|
[ Nginx / Apache web server ] <- forwards web requests
|
[ Your application (PHP, Node, etc.) ]
|
[ MySQL / MariaDB database ] <- stores all your data
On Ubuntu (22.04 / 24.04 LTS), it installs through apt (the package manager) and runs as a background service managed by systemd (the tool Ubuntu uses to start, stop, and supervise services). Files land in predictable places:
| Path | What it holds |
|---|---|
/etc/mysql/ | Configuration files |
/var/lib/mysql/ | The actual data (your tables and rows) |
/var/log/mysql/ | Log files for debugging |
You can confirm whether it is installed and check the version with one command:
mysql --version
Output:
mysql Ver 8.0.39-0ubuntu0.24.04.1 for Linux on x86_64 ((Ubuntu))
Once it is running, you check the service through systemd. The service is called mysql for Oracle’s MySQL and mariadb for MariaDB:
sudo systemctl status mysql
Output:
● mysql.service - MySQL Community Server
Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled)
Active: active (running) since Mon 2026-06-15 09:12:44 UTC; 2h ago
Main PID: 921 (mysqld)
Gotcha: A fresh install accepts local connections and, depending on version, may have a blank or insecure root setup. Never expose port
3306to the internet withufw(Ubuntu’s firewall) and never leave the root account unsecured — running the secure-installation step is mandatory, not optional. Opening a database to the world is one of the most common ways servers get hacked.
Best Practices
- Pick one of MySQL or MariaDB per server — they share the same port and cannot run side by side by default.
- Treat MariaDB as a safe, fully open-source default unless specific software demands Oracle’s MySQL.
- Always run the secure-installation hardening step immediately after installing, before storing any real data.
- Keep the database listening on localhost only until you genuinely need remote access and have firewall rules in place.
- Learn the
mysqlcommand-line client — it is the fastest way to inspect and fix data on a live server. - Note the major version you install (e.g. MySQL 8.0 or MariaDB 11) — upgrade steps and some features depend on it.
- Set up tested backups from day one; a database without verified backups is a future outage waiting to happen.