The dependable workhorse on nearly every shared host.
MySQL is one of the world's most widely deployed relational databases. It stores data in tables, speaks SQL, and has been the "M" in the classic LAMP stack (Linux, Apache, MySQL, PHP) for decades - which is why it comes pre-installed on virtually every shared hosting plan, usually with the phpMyAdmin web interface for managing it.
It's rock-solid, fast for the read-heavy workloads typical of websites, and so common that nearly every tutorial, CMS, and hosting panel assumes it.
MySQL is the natural pick on shared hosting - it's already there, already configured, and pairs perfectly with PHP. It handles structured data (users, products, posts) extremely well and is a great first "real" database because the SQL you learn transfers everywhere. For zero-setup local learning, SQLite is even simpler; for feature depth and large-scale growth, PostgreSQL has the edge.
VARCHAR, INT, DATETIME…).
id automatically.
CREATE TABLE guestbook (
id INT AUTO_INCREMENT PRIMARY KEY,
author VARCHAR(100) NOT NULL,
message TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO guestbook (author, message)
VALUES ('Sam', 'First post!');
SELECT author, message FROM guestbook
ORDER BY created_at DESC;
Standard SQL - create a table, add a row, read it back. This exact pattern is behind most contact forms and comment sections on the web.
mysql2 in
Node.js - using prepared
statements for any user input.
utf8 instead of utf8mb4. MySQL's legacy utf8 can't store emoji and some other characters. Use utf8mb4 for databases, tables and connections.
WHERE, JOIN and ORDER BY, so queries slow down as tables grow.
DATETIME and TIMESTAMP. TIMESTAMP converts to and from the connection's time zone; DATETIME stores exactly what you give it. Pick one deliberately and store times in UTC.
ONLY_FULL_GROUP_BY, which modern MySQL enables by default. Every selected column must be grouped or aggregated.
On shared hosting, MySQL (or MariaDB) is already included - create a database and user in the control panel and manage it with phpMyAdmin. Our PHP + MySQL guide walks through it.
Off shared hosting, every major cloud offers managed MySQL (AWS RDS, Google Cloud SQL, Azure, DigitalOcean), with automated backups and updates.