How to install MySQL 8.0 on Ubuntu 20.04

In this article, we will see how to install MySQL 8.0 on Ubuntu 20.04 step by step.

MySQL community server is a free open source, popular and cross-platform database management system.

Step1: Add MySQL apt repository.

wget -c https://repo.mysql.com/mysql-apt-config_0.8.16-1_all.deb

How to install MySQL 8.0 on Ubuntu 20.04

Step2: Install the MySQL repository package using the following dpkg command.

sudo dpkg -i mysql-apt-config_0.8.16-1_all.deb

MySQL server version mysql-8.0 will be auto-selected, then scroll down to the last option Ok and click [Enter] to finish the configuration and installation of the release package, as shown in the screenshot.

Step3: Update latest packages information and Install MySQL 8.

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

sudo apt-get update sudo apt-get install mysql-server

Type Y to continue.

Provide password for root.

Then, re-enter password for root.

Next, the MySQL server authentication plugin configuration message will appear, read through it and use the right arrow to choose Ok and press [Enter] to continue.

Afterwards, 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.

Step 4: Lets check Installed MySQL Server version.

mysql -V

Step5: Lets verify the MySQL Server status by using below command.

systemctl status mysql

MySQL Post Installation steps:

Step 1: Secure MySQL Server Installation

By default, the MySQL installation is unsecure. To secure it, run the security script which comes with the binary package. You will be asked to enter the root password you set during the installation process.

Step2: Answer the security questions Yes/Y/No/N.

Step 3. Connect to MySQL Server using below command.

mysql -u root -p

Then, provide password for root.

To get list of databases present in MySQL Server run the command show databases;

mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+

So in this article, we have explained How to install MySQL 8.0 on Ubuntu 20.04 step by step.