The idea
MySQL is an open-source database management system. It uses SQL (Structured Query Language) to add, read, change and delete data in a database. A database is an organized store of information in tables, with rows and columns.
Because MySQL is open source, it is free to use and popular with developers. It is the base of many well-known web applications.
Why websites use MySQL
Most modern content management systems (CMS) store their data in MySQL or MariaDB: WordPress, Joomla, Drupal, Magento and many others. Every change you make in the CMS is saved in the database. Each time a visitor opens a page, the system reads the content from the database and shows it.
A WordPress database holds, for example:
- Your posts and pages.
- Comments.
- Users and their roles.
- Settings and plugin data.
What a database looks like
A database has tables. A table has columns (fields) and rows (records).
| id | name | |
|---|---|---|
| 1 | Anna | anna@example.com |
| 2 | Omar | omar@example.com |
You ask questions with SQL:
SELECT name, email FROM users WHERE id = 1;
Manage MySQL
- phpMyAdmin. A web tool, available in cPanel and other panels.
- MySQL command line.
mysql -u user -p. - MySQL Workbench. A desktop tool.
Good practice
- Use a separate user for each application, with only the rights it needs.
- Use strong passwords.
- Back up your databases regularly.
- Keep the software updated.
Quick recap
- MySQL stores the data of your website in tables, and SQL is the language to work with it.