MySQL
MySQL is an open-source relational database management system that has been a core part of web infrastructure for decades. It stores data in tables with rows and columns, uses SQL (Structured Query Language) to query and manipulate that data, and is built around a client-server model where applications connect to a running MySQL server process.
It’s the M in the classic LAMP stack (Linux, Apache, MySQL, PHP), and it remains one of the most widely deployed databases in production — used by small personal projects and large-scale web applications alike. MariaDB, a community fork with full MySQL compatibility, has largely replaced MySQL in most Linux distribution package repositories but behaves nearly identically for most use cases.
Getting started
The first step is installing and setting up MySQL. Once the server is running you’ll want to know how to access a MySQL database from the command line, create a database, show existing databases, and show tables within a database. These are the commands you’ll use constantly.
User management matters early too — the default root setup isn’t suitable for application use. The guide on adding a user and granting permissions covers the right way to set up access.
Day-to-day administration
Common administrative tasks covered here include:
- Backing up a MySQL database — essential before any schema change or migration
- Restarting MySQL — needed after config changes or when the service gets into a bad state
- Repairing a MySQL database — for dealing with table corruption
- Changing a MySQL password
- Checking the MySQL version
Knowing where MySQL stores its database files is useful when you’re managing disk space or moving a database between servers.
Schema and queries
SQL itself is a large topic, but a few specific operations come up often enough to be worth having handy. Adding a column with ALTER TABLE, setting up an auto-increment primary key, counting rows in a table, and using multiple WHERE conditions are all covered.
MySQL with Python
MySQL is commonly used from Python applications, either for scripting or as a backend for web apps. The site covers creating a MySQL database using Python and inserting user input into a MySQL database from Python. If you’ve hit the failed building wheel for mysql-python error during a pip install, there’s a fix for that too.
Errors and gotchas
A few common problems have dedicated pages:
- Access denied for user ‘root’@’localhost’ — one of the most common MySQL errors and easier to fix than it looks
- MySQL Error 1175 — the safe update mode error that blocks UPDATE and DELETE without a key condition
- PHP missing MySQL extension (WordPress) — a frequent issue when setting up WordPress on a new server
MySQL Install Video
If you want to watch me install MySQL I’ve published this video: