In today’s world, data is KING. No business can survive without good, reliable data. And no data can be good without a good, reliable database. In this tutorial will explain how to install latest database MySQL 8.0 Community Server on Ubuntu and Debian Linux server.

So, what is a database, exactly? A database is a collection of information that can be accessed by computers. It stores information about customers, products, orders, etc.

MySQL is a popular database. It is used by millions of web and business applications. It is free and easy to use. MySQL is a relational database. This means that it stores data in tables. A table is a collection of records. Each record is composed of a column

The MySQL is Dual Licensed. Users can choose to use the MySQL as an Open Source product under the terms of the GNU General Public License ( or can purchase a standard commercial license from Oracle. See for more information.

MySQL Database Lifecycle

VersionRelease DateEnd of life
8.008 Apr 201830 Apr 2026
5.709 Oct 201531 Oct 2023
5.601 Feb 201328 Feb 2021
MySQL Database EOL
latest mysql 8.0 installation on Ubuntu and Debian
Latest MySQL 8.0 installation on Debian based server

Steps to install MySQL 8.0 on Ubuntu and Debian Linux server

Installation of MySQL Database 8.0 on Linux is easy. This tutorial will explain how to install MySQL version 8.0 Community Server edition on Ubuntu and Debian based servers.

If you want to install MySQL on RHEL based servers then please read this article.


  • sudo privileges.
  • Stable internet connection.
  • Disable SELinux and Firewall


If you want to install default available MySQL version then run following command:

# apt install mysql-community-server -y

Install latest MySQL 8.0 on Ubuntu and Debian server :

Steps to install MySQL 8.0 on Ubuntu and Debian Linux server

Check your current Operating System version if you are not sure:

# egrep '^(VERSION|NAME)=' /etc/os-release

Install the prerequisites:

# apt install -y curl wget gnupg2

We need to add GPG key for MySQL repo:

# apt-key adv --keyserver --recv-keys 467B942D3A79BD29

Now set up the apt repository as per your Ubuntu version:

For Ubuntu 22.04 (Jammy)
# echo "deb jammy mysql-apt-config
deb jammy mysql-8.0
deb jammy mysql-tools
deb jammy mysql-cluster-8.0
deb-src jammy mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

For Ubuntu 20.04 (Focal):
# echo "deb focal mysql-apt-config
deb focal mysql-8.0
deb focal mysql-tools
deb focal mysql-cluster-8.0
deb-src focal mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

For Ubuntu 18.04 (Bionic):
# echo "deb bionic mysql-apt-config
deb bionic mysql-8.0
deb bionic mysql-tools
deb bionic mysql-cluster-8.0
deb-src bionic mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

For Ubuntu 16.04 (Xenial):
# echo "deb xenial mysql-apt-config
deb xenial mysql-8.0
deb xenial mysql-tools
deb xenial mysql-cluster-8.0
deb-src xenial mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

Or set up the apt repository as per your Debian version:

For Debian 11 "bullseye"
# echo "deb bullseye mysql-apt-config
deb bullseye mysql-8.0
deb bullseye mysql-tools
deb bullseye mysql-cluster-8.0
deb-src bullseye mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

For Debian 10 "Buster"
# echo "deb buster mysql-apt-config
deb buster mysql-8.0
deb buster mysql-tools
deb buster mysql-cluster-8.0
deb-src buster mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

For Debian 9 "Stretch"
# echo "deb stretch mysql-apt-config
deb stretch mysql-8.0
deb stretch mysql-tools
deb stretch mysql-cluster-8.0
deb-src stretch mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

For Debian 8 "Jessie"
# echo "deb jessie mysql-apt-config
deb mysql-8.0
deb jessie mysql-tools
deb-src jessie mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

Then update the local package database:

#  apt update

Then Install the MySQL 8.0 latest version:

# apt install -y mysql-community-server

In installation process MySQL will ask for root password, so set complex password for security purpose and most important save password to safe place before preceding. Then select strong password Encryption method to complete the setup.

 Managing the MySQL service

let’s review some basic management commands.

Verify installed version of MySQL:

#  mysql --version

Start the MySQL service:

# systemctl start mysql.service

Check status of the MySQL service:

# systemctl status mysql.service

Restart the MySQL service:

# systemctl restart mysql.service

If you want to stop MySQL service:

# systemctl stop mysql.service

By default, MySQL service is disabled to start automatically when the server boots. If you want to enable it at startup, run:

# systemctl enable mysql.service

Re-disable the service to start up at boot:

# systemctl disable mysql.service

Uninstall MySQL

To completely remove MySQL from a system, you must remove the MySQL applications, the configuration files, and any directories containing data and logs.

WARNING: This process will completely remove MySQL, its configuration, and all databases. This process is not reversible, so ensure that all of your configuration and data is backed up before proceeding.

Stop the MySQL service

# systemctl stop mysql.service

Remove any MySQL packages that previously installed.

# apt autoremove --purge mysql*

Remove MySQL databases and log files.

# rm -rf /var/lib/mysql /var/log/mysql /etc/mysql /var/run/mysqld /etc/apparmor.d/abstractions/mysql


Congratulations! We’ve installed latest MySQL 8.0 on Ubuntu and Debian Linux servers. We hope this 2 minutes stuff helped you and thank you for visiting our website.