MySQL Database Basics Explained for Linux and Cloud Engineers
Introduction
MySQL is one of the most popular open-source relational database management systems (RDBMS).
It is widely used in web applications, cloud platforms, and enterprise environments.
As a Linux or Cloud Engineer, understanding MySQL basics helps you in installation, configuration, troubleshooting, and supporting application teams.
What is a Database?
A database is an organized collection of data. Instead of keeping data in text files or spreadsheets, databases store data in a structured way so that applications can quickly read and write it.
For example: A shopping website stores users, products, and orders in different database tables.
Relational Database Basics
- Tables: Similar to Excel sheets with rows and columns.
- Rows: Each record (example: one user information).
- Columns: Fields (example: user_id, name, email).
- Primary Key: A unique identifier for each row (example: user_id).
- Foreign Key: A reference to connect one table with another (example: orders linked to user_id).
Why MySQL?
- Free and open-source.
- Very fast and reliable.
- Easy to integrate with PHP, Python, Java, WordPress, etc.
- Supported on Linux, Windows, and Cloud platforms.
MySQL Installation (Linux)
On Rocky Linux / CentOS:
sudo dnf install mysql-server -y
sudo systemctl start mysqld
sudo systemctl enable mysqld
On Ubuntu/Debian:
sudo apt update
sudo apt install mysql-server -y
sudo systemctl start mysql
sudo systemctl enable mysql
Basic MySQL Commands
- Login to MySQL:
mysql -u root -p
- Show databases:
SHOW DATABASES;
- Create a database:
CREATE DATABASE mydb;
- Create a user:
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'password';
- Grant privileges:
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
- Use a database:
USE mydb;
- Create a table:
CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50), email VARCHAR(100));
- Insert data:
INSERT INTO users (name, email) VALUES ('Shahzad', 'shahzad@example.com');
- Select data:
SELECT * FROM users;
MySQL Important Files in Linux
/etc/my.cnf
→ Main configuration file./var/lib/mysql/
→ Default data directory./var/log/mysqld.log
→ Log file for errors.
MySQL for Cloud Engineers
In cloud platforms (AWS RDS, GCP Cloud SQL, Azure Database for MySQL), MySQL is offered as a managed service.
This means engineers don’t have to manage installation and patching, only focus on performance, backups, and connectivity.
Use Cases of MySQL
- Websites and CMS (WordPress, Joomla, Drupal).
- E-commerce platforms (Magento, WooCommerce).
- Cloud-native applications.
- Enterprise data storage and analytics.
Conclusion
MySQL is simple to learn but very powerful for real-world applications.
By understanding databases, tables, basic SQL commands, and MySQL configuration files,
Linux and Cloud Engineers can support developers and manage production systems efficiently.