MySQL is an open-source relational (SQL) database owned and maintained by Oracle Corporation. It's the second most-used database in developer surveys, at roughly 40.5% usage share. It became famous as the "M" in the LAMP stack and still powers WordPress and huge swaths of the PHP-driven web โ developers pick it for its simplicity and the sheer amount of hosting-provider support built around it.
Straightforward, standard SQL โ create a table, insert a row, then query it.
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO users (username) VALUES ('rafie99');
SELECT id, username
FROM users
WHERE created_at >= NOW() - INTERVAL 7 DAY;
Install the server directly, or run one in Docker for a zero-mess local setup, then connect with the mysql CLI client.
# Docker: run a local MySQL instance
docker run --name mysql-db -e MYSQL_ROOT_PASSWORD=secret -p 3306:3306 -d mysql:8
# connect with the mysql CLI
mysql -h 127.0.0.1 -u root -p