Databases 69 min read

Master MySQL: Installation Guide Across Linux Distros & Key Features

This comprehensive guide introduces MySQL’s core concepts, architecture, and features, then walks you through step‑by‑step installation and configuration on popular Linux distributions—including Rocky, AlmaLinux, CentOS, Ubuntu, Debian, and openSUSE—covering network setup, repository configuration, and post‑install security tweaks.

Raymond Ops
Raymond Ops
Raymond Ops
Master MySQL: Installation Guide Across Linux Distros & Key Features

MySQL Introduction and Installation

1. MySQL Introduction

MySQL is a widely used open‑source relational database management system (RDBMS) that supports a variety of applications from small websites to large enterprise systems.

1.1 Definition of MySQL

MySQL is a high‑performance, multi‑user, multi‑threaded SQL database server that uses SQL as its interface. It was originally developed by MySQL AB, later acquired by Sun Microsystems and now owned by Oracle, while remaining open source under the GPL license.

1.2 Key Features

Open source and free

High performance

Cross‑platform (Linux, Windows, macOS, etc.)

Easy to use with command‑line and graphical tools (e.g., MySQL Workbench)

Strong scalability (clustering, replication, sharding)

High security (user privileges, data encryption, SSL/TLS)

1.3 Application Areas

Web development – stores articles, comments, user data.

Enterprise applications – handles business data, transactions, and CRM.

Big data analysis – can serve as a data warehouse source for analytics tools.

Mobile backend – stores user profiles, configuration, and messages.

1.4 Storage Engines

MySQL supports multiple storage engines, each with its own characteristics:

InnoDB – default engine, provides ACID transactions, row‑level locking, and foreign‑key support.

MyISAM – older engine, fast for read‑heavy workloads but lacks transaction support.

Memory – stores data in RAM for ultra‑fast access; data is lost on restart.

1.5 Architecture

Client layer – command‑line tools, GUI clients, or programming language connectors.

Server layer – connection pool, query parser, optimizer, and cache.

Storage‑engine layer – interacts with the chosen storage engine to read/write data.

1.6 Advantages and Limitations

Advantages : excellent performance, low cost, strong community support, easy to learn and deploy.

Limitations : fewer advanced analytics features than some commercial databases, potential data‑consistency issues if non‑transactional engines are used, higher maintenance complexity at large scale.

1.7 Future Development Trends

Continued performance optimization for high concurrency and large data volumes.

Deeper integration with cloud platforms (e.g., Amazon RDS, Alibaba Cloud MySQL).

2. MySQL Installation

2.1 Host Initialization

2.1.1 Set Network Interface Name

For Rocky Linux 9/10, AlmaLinux 9/10, CentOS Stream 9/10, AnolisOS 23, OpenCloudOS 9 and similar distributions, create a systemd link file to rename the network interface to eth0:

# mkdir -p /etc/systemd/network/
# touch /etc/systemd/network/70-eth0.link
# cat > /etc/systemd/network/70-eth0.link <<EOF
[Match]
MACAddress=00:0c:29:f8:60:8f

[Link]
Name=eth0
EOF

2.1.2 Modify NetworkManager Configuration

Rename the connection profile and update the interface name:

# mv /etc/NetworkManager/system-connections/ens160.nmconnection /etc/NetworkManager/system-connections/eth0.nmconnection
# sed -i.bak 's/ens160/eth0/' /etc/NetworkManager/system-connections/eth0.nmconnection

2.1.3 Configure Repository Mirrors

Replace the default mirror with a faster one (e.g., Alibaba Cloud) for Rocky Linux 9:

# MIRROR=mirrors.aliyun.com
# sed -i.bak -e 's|^mirrorlist=|#mirrorlist=|g' \
    -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://'${MIRROR}'/rockylinux|g' \
    /etc/yum.repos.d/[Rr]ocky*.repo
# dnf clean all && dnf makecache

2.1.4 Disable Firewall and Security Modules

# systemctl disable --now firewalld   # RHEL‑based systems
# systemctl disable --now ufw        # Ubuntu/Debian
# setenforce 0 && sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config   # SELinux
# systemctl disable --now apparmor  # openSUSE

2.1.5 Set Timezone

# timedatectl set-timezone Asia/Shanghai

2.2 Package Installation

2.2.1 Yum Repository Installation (RHEL‑based)

Install MySQL 8.0 on Rocky Linux 9, AlmaLinux 9, CentOS Stream 9, etc.:

# yum install -y wget
# wget https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm
# rpm -ivh mysql84-community-release-el9-1.noarch.rpm
# yum makecache
# yum install -y mysql-community-server
# systemctl enable --now mysqld

Verify installation:

# mysql -V
# systemctl status mysqld

2.2.2 Apt Repository Installation (Debian/Ubuntu)

For Ubuntu 24.04 LTS, install MySQL 8.0 from the official Ubuntu repository:

# apt update
# apt install -y mysql-server
# systemctl enable --now mysql
# mysql -V
# systemctl status mysql

For MySQL 8.4, add the MySQL APT repository:

# wget https://dev.mysql.com/get/mysql-apt-config_0.8.34-1_all.deb
# dpkg -i mysql-apt-config_0.8.34-1_all.deb   # select "mysql-8.4-lts"
# apt update
# apt install -y mysql-community-server
# systemctl enable --now mysql

2.2.3 Zypper Repository Installation (openSUSE)

Install MySQL 8.0 on openSUSE 15:

# wget https://repo.mysql.com//mysql80-community-release-sl15-1.noarch.rpm
# rpm -Uvh mysql80-community-release-sl15-1.noarch.rpm
# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
# zypper refresh
# zypper install -y mysql-community-server
# systemctl enable --now mysql

2.3 Post‑Installation Configuration

Retrieve the temporary root password generated on first start:

# grep 'temporary password' /var/log/mysqld.log
# mysqladmin -uroot -p'<temporary_password>' password 'YourStrong!Pass123'
# mysql -uroot -p'YourStrong!Pass123'
mysql> status;
mysql> show databases;

2.4 Visual Guides

MySQL logo:

MySQL logo
MySQL logo

Downloading the MySQL Yum repository package (Rocky Linux example):

Yum repository download
Yum repository download

Downloading the MySQL APT repository package (Ubuntu example):

APT repository download
APT repository download

MySQL 8.4 installation on Ubuntu – configuration wizard screenshots:

MySQL version selection
MySQL version selection
MySQL version confirmation
MySQL version confirmation

MySQL 8.4 installation on Debian – repository configuration wizard screenshots:

Debian MySQL repository selection
Debian MySQL repository selection

Final verification of MySQL service status:

# systemctl status mysql
# mysql -V

After completing the steps above, MySQL is ready for use on the target system.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

SQLdatabaseLinuxmysqlInstallation
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.