New Try managed PHP hosting on Amezmo for FREE with a $50 account credit. Create account →

How to install MySQL 8 on Ubuntu 18.04

Amezmo on

MySQL 8 is the latest and greatest version of MySQL and with the recent news of Ubuntu 16.04 reaching end of life, it’s time to finally upgrade to Ubuntu 18.04. By default, Ubuntu 18.04 comes with MySQL 5.7 available via apt. MySQL 8.0 comes with a lot of new features. Running MySQL 8 with a PHP application such as Laravel, or CraftCMS is easy with Amezmo.

In this MySQL 8 tutorial, you will install the MySQL server on Ubuntu 18.04. This guide assumes you already have installed Ubuntu 18.04, and have not yet installed any version of MySQL.


  • An Ubuntu 18.04 server


  1. Install MySQL key from the GPG key server
  2. Add the MySQL APT repository to the sources list
  3. Update apt
  4. Install the MySQL server

Install the MySQL key from the GPG key server

MySQL 8 isn’t available by default in Ubuntu 18.04. But not to worry. We can install the official package from the MySQL release team and install it normally with APT. With just a few commands, we’ll be all set.

sudo apt-key adv --keyserver --recv-keys 5072E1F5

Add the MySQL APT repository to the sources list

So now we have securely imported the MySQL public key. This helps be sure we’re installing MySQL from the official source.

echo 'deb bionic mysql-8.0' > sudo /etc/apt/sources.list.d/mysql.list

Update apt

Now we need to update apt to let it know that we have a new source list.

sudo apt-get --quiet update

Install the MySQL server

Now MySQL can be installed as usual with the default apt commands. In this command, we’ll install the mysql-server package from apt.

sudo apt-get --no-install-recommends install mysql-server

Host and Deploy Your PHP Apps for Free
Sign up today and see if Amezmo is right for you.