upgrade mysql 5.7 to 8 ubuntu 18.04

Posted November 28, 2019 25.8k views

upgrade mysql 5.7 to 8 ubuntu 18.04

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @admin5f22619f891220d4d6936,

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. Let’s try using the APT Repository in this example.

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.10-1_all.deb

It will show you a prompt, press Enter when you choose** mysql server ,then select mysql 8.0**.

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

Please note you’ll need to do some research before actually updating MySQL.

  1. Make sure your application(wordpress) actually supports MySQL 8
  2. Make sure to have a working backup of your MySQL databases in case anything goes wrong.


  • Sadly, doesnt work..
    the following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering

    W: GPG error: bionic InRelease: The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering
    E: The repository ’ bionic InRelease’ is not signed.

  • Here is how to fix the invalid key issue:
    This is the issue. Snipped from this post

    “gpg: key 8C718D3B5072E1F5: "MySQL Release Engineering” not changed"

    “EXPKEYSIG 8C718D3B5072E1F5”

    The error message you received said that the bolded key above is expired. When you tried to get the new public key, the response said that the same key was not changed. The issue is that you still have not obtained a copy of the new public key.

    Follow this link to a copy of the new key. You will see that they have the option for you to copy and paste the key.

    You will want to copy and paste it into a text file, which can be saved anywhere, really. Then you will want to add the key with:

    sudo apt-key add /path/to/your/key.txt

    This will add that key to your apt key ring.

    Remove the expired key by sudo apt-key del 8C718D3B5072E1F5

    Additional Tips:
    After removing the old expired key run apt update again.
    run apt install mysql-server