Databases 15 min read

Step‑by‑Step: Install MySQL 8.0/8.4 on Ubuntu 24.04 and Debian 11/12

This guide walks you through adding the MySQL APT repository, selecting the desired MySQL version, installing required dependencies, configuring the package source, installing MySQL on Ubuntu 24.04 and Debian 11/12, enabling the service, and verifying the installation with status checks and database listings.

Raymond Ops
Raymond Ops
Raymond Ops
Step‑by‑Step: Install MySQL 8.0/8.4 on Ubuntu 24.04 and Debian 11/12

Installing MySQL from the Apt Repository

This section describes how to install MySQL 8.0 or 8.4 on Ubuntu 24.04 and Debian 11/12 using the official MySQL APT repository.

1. Add the MySQL APT repository

Download the repository package and install it with dpkg. On Debian you may need to install gnupg first.

# 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
# apt update

2. Choose the MySQL version

During the dpkg configuration, use the arrow keys to select the desired version (e.g., mysql-8.0 or mysql-8.4-lts) and confirm with Enter.

3. Install MySQL server

# apt install -y mysql-community-server

4. Enable and start the service

# systemctl enable --now mysql

5. Verify the installation

# mysql -V
# systemctl status mysql
# mysql -e "SHOW DATABASES;"
# mysql -e "STATUS;"

Typical output shows the MySQL version (e.g., 8.0.43‑0ubuntu0.24.04.2 or 8.4.6‑1ubuntu24.04), confirms the service is active, and lists the default databases ( information_schema, mysql, performance_schema, sys).

6. Optional: Replace the default repository with a domestic mirror

# sed -i.bak 's|http://repo.mysql.com|https://mirrors.nju.edu.cn/mysql|g' /etc/apt/sources.list.d/mysql.list
# apt update

After the mirror change, repeat step 3 to install the server from the new source.

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.

LinuxmysqlUbuntuDebian
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.