How do I update MySQL 5.7 to the new MySQL 8.0?

You can find answer in mysql doc.
It has full details about how to upgrade.
Make sure to back up data before upgrading.

There are tons of ways to upgrade in the docs.
The way i choose is to use APT Repository.

You should do the following things:

First, add the MySQL APT repository to your system’s software repository list. The details in docs are a little abstract , i’ll give a example:

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

Then you’ll get this:

enter image description here

press Enter when you choose mysql server ,then select mysql 8.0.Finally choose like this:

enter image description here

Once the repo has been added, update apt index and install mysql-server:

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

Now if you don’t get any error messages, you have already upgraded successfully.
You can confirm by:

apt policy mysql-server

You will get output like this:

$ apt policy mysql-server
      Installed: 8.0.13-1ubuntu18.04
      Candidate: 8.0.13-1ubuntu18.04

Leave a Comment