Installing MySQL 8.0 on Ubuntu 16.04 LTS in Five Minutes

Do you want to install MySQL 8.0 on Ubuntu 16.04 LTS? In this quick tutorial, I show you exactly how to do it in five minutes or less.

This tutorial assumes you don’t have MySQL or MariaDB installed. If you do, it’s necessary to uninstall them or follow a slightly more complicated upgrade process (not covered here).

Step 1: Install MySQL APT Repository

Ubuntu 16.04 LTS, also known as Xenial, comes with a choice of MySQL 5.7 and MariaDB 10.0.

If you want to use MySQL 8.0, you need to install the MySQL/Oracle Apt repository first:

The MySQL APT repository installation package allows you to pick what MySQL version you want to install, as well as if you want access to Preview Versions. Let’s leave them all as default:

Installing MySQL 8.0 on Ubuntu

Step 2: Update repository configuration and install MySQL Server

Note: Do not forget to run “apt-get update”, otherwise you can get an old version of MySQL from Ubuntu repository installed.

The installation process asks you to set a password for the root user:

Installing MySQL 8.0 on Ubuntu 1

I recommend you set a root password for increased security. If you do not set a password for the root account, “auth_socket” authentication is enabled. This ensures only the operating system’s “root” user can connect to MySQL Server without a password.

Next, the installation script asks you whether to use Strong Password Encryption or Legacy Authentication:

Installing MySQL 8.0 on Ubuntu 2

While using strong passwords is recommend for security purposes, not all applications and drivers support this new authentication method. Going with Legacy Authentication is a safer choice

All Done

You should have MySQL 8.0 Server running. You can test it by connecting to it with a command line client:

Installing MySQL 8.0 on Ubuntu 3

As you can see, it takes just a few simple steps to install MySQL 8.0 on Ubuntu 16.04 LTS. Go ahead give it a try!

You May Also Like

Migrating charsets can be a tedious and arduous task. Percona Architect Francisco Bordenave has put together a useful guide to performing charset conversion with minimal downtown and pain. Check out his blog, Migrating Database Charsets to utf8mb4: A Story from the Trenches, for more information.

There’s a new player in the Oracle High Availability solution field, MySQL InnoDB Cluster. Francisco discusses how to install it over MySQL to utilize its multi-master capabilities and automatic failover by using group replication, MySQL router, and MySQL Shell.

Share this post

Comments (4)

  • Dan

    Short, clear, and right on target. Now that’s documentation!
    Thanks Peter!

    June 4, 2018 at 12:26 pm
  • steve

    Thank you so much! It saved my day!

    February 15, 2019 at 11:29 am
  • Makabata Jeremia Mokgolobotho

    Hi, does anyone know how to get the MySQL Workbench tool for version 8?

    April 24, 2019 at 3:17 am
  • Leib

    Hi, very clear.
    Could you also provide instructions how to upgrade from 5.7 to 8.0

    Tried just to follow this instructions but got this error by the end.
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    July 17, 2019 at 6:42 pm

Comments are closed.

Use Percona's Technical Forum to ask any follow-up questions on this blog topic.