Table of Contents


The MySQL APT repository provides a simple and convenient way to install and update MySQL products with the latest software packages using Apt.

The MySQL APT repository provides MySQL packages for the following Linux distros:

  • Debian
  • Ubuntu

The MySQL APT repository includes the latest versions of:

  • MySQL 8.2
  • MySQL 8.1
  • MySQL 8.0
  • MySQL 5.7
  • MySQL Cluster 8.2
  • MySQL Cluster 8.1
  • MySQL Cluster 8.0
  • MySQL Cluster 7.6
  • MySQL Cluster 7.5
  • MySQL Workbench - Ubuntu Only
  • MySQL Router
  • MySQL Shell
  • MySQL Connector/C++
  • MySQL Connector/J
  • MySQL Connector/ODBC
  • MySQL Connector/Python

Step 1: Add MySQL Apt Repository

Downloading the repository package using the wget or curl tool from the command line.


wget -c

Or use curl

curl -OL

Then install the MySQL repository package using the following dpkg command.

sudo dpkg -i mysql-apt-config_0.8.28-1_all.deb
You Can Disable MySQL Tools & Connectors

Step 2: Install MySQL Server in Ubuntu

Next, download the latest package information from all configured repositories, including the recently added MySQL repository.

sudo apt update

Then run the following command to install packages for the MySQL community server

sudo apt-get install mysql-server

Through the installation process, you will be asked to enter a password for the root user for your MySQL server, re-enter the password to confirm it, and press [Enter].

Set MySQL root user password

You will be asked to select the default authentication plugin to use, then use the right arrow to choose Ok and press [Enter] to complete the package configuration.

MySQL Authentication Plugin

Step 3: Secure MySQL Server Installation

By default, the MySQL installation is insecure.

Execute the below script

sudo mysql_secure_installation

You will be asked to enter the root password you set during installation. Then also choose whether to use the VALIDATE PASSWORD plugin or not.

  • Change the password for root: if you want press Y
  • Remove anonymous users? : y
  • Disallow root login remotely? : y
  • Remove the test database and access it. : y
  • Reload privilege tables now? : y
Secure MySQL Server Installation

Step 4: Managing MySQL Server via Systemd

To Know the Server Status run the below command

sudo systemctl status mysql
Check MySQL Server Status

Step 5: Auto Restart on System or Server Boot

sudo systemctl enable mysql

Finally, to access the MySQL shell

sudo mysql -u root -p

MySQL :: A Quick Guide to Using the MySQL APT Repository

For more additional or advanced requirements follow this Official Link.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to BugFix.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.