Google Cloud MySQL

How to Install MySQL 8.0 on Ubuntu 18.04

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

How to Install MySQL 8.0 on Ubuntu 18.04. MySQL is an open source database management system used to store and retrieve data for a wide variety of popular applications.

To use the most new features of MySQL it is necessary to install the latest version of MySQL. In this guide you are going to learn how to install MySQL 8.0 on your Ubuntu 18.04.

Add MySQL Software Repository

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

To get the latest release go to MySQL downloads page and click the download button at the bottom right. In the Begin your Download page right click on the No thanks, just start my download and copy the link address.

Go to your server and download the file using the link you have copied.

cd /tmp
sudo curl -OL

Now a .deb software package will get downloaded to your server.

Use the dpkg command to install the package.

sudo dpkg -i mysql-apt-config*

You will prompted to choose the version, you can move to OK menu and hit Enter

sudo apt update

Now the MySQL repository is added and you can delete the downloaded file.

sudo rm mysql-apt-config*

Install MySQL 8.0

Once the package is added and the cache is refreshed you can install MySQL Server.

sudo apt install mysql-server

You can provide a secure password for your root. Next you need to configure the authentication plugin. Use the default Use Strong Password Encryption and hit Enter.

Wait for the installation to complete.

Once the installation is complete you can view the status of the MySQL server using the following command.

sudo systemctl status mysql
 ● mysql.service - MySQL Community Server
    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
    Active: active (running) since Thu 2019-06-25 17:46:42 UTC; 13s ago
      Docs: man:mysqld(8)
  Main PID: 7918 (mysqld)
     Tasks: 37 (limit: 1152)
    CGroup: /system.slice/mysql.service
            └─7918 /usr/sbin/mysqld

Securing MySQL

Once the installation is completed it is necessary to secure the MySQL installation.

  • Enable the validate password plugin
  • Update the root password if you need
  • Remove anonymous MySQL user
  • Remove test database
  • Reload privileges

Now your installation is secured.


Now you have learned how to install MySQL 8.0 on Ubuntu 18.04. Next you can proceed to create database and assign users.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.