42

I already have mysql-server package installed!!!

I want to make sure I have the most recent MySQL in my Ubuntu. So (long time ago) I added repo.mysql.com/apt/ubuntu PPA. Recently I noticed errors related to this repository when doing apt update. Following this guide I've downloaded and imported public GPG key.

Now when I do sudo apt update I get this error:

Err:8 http://repo.mysql.com/apt/ubuntu cosmic InRelease
  The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <[email protected]>

OS information: Ubuntu 18.10

Should I worry about this invalid signature? How to fix the error?

0

5 Answers 5

56

The error you are seeing indicates that your key is expired.

You can list all keys on your system with the command sudo apt-key list if you wish to narrow the output you can always pipe the output through grep expired to obtain just a list of the expired keys.

For each expired key, issue the command sudo apt-key adv --keyserver [KEY_SERVER] --recv-keys [KEY] where [KEY] is related to the number in question or in this case:

8C718D3B5072E1F5

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8C718D3B5072E1F5 keyserver.ubuntu.com refers to an open PGP keyserver run by Canonical, Ltd.

You can also search for the key via web interface at keyserver.ubuntu.com

where you'll get a page similar but not identical to this:

enter image description here

Entering the key from the EXPKEYSIG preceded by 0x in the search box and searching should return results similar to this:

enter image description here

To the best of my knowledge the 8 hex digits is the short version (public key) you need to obtain an updated key with the command

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5072E1F5

Sources:

7
  • I supposed to do all these in Ansible playbook. Any idea?
    – SenG
    Aug 13, 2020 at 2:10
  • @SenG Perhaps you find this useful. middlewareinventory.com/blog/ansible-playbook-example
    – Elder Geek
    Mar 23, 2021 at 13:46
  • 2
    Looks like keys.gnupg.net from the answer isn't available anymore. I tried to use keyserver.ubuntu.com and it worked.
    – maksadbek
    Dec 5, 2021 at 0:59
  • @maksadbek Nice catch! I'll edit.
    – Elder Geek
    Dec 16, 2021 at 16:57
  • 2
    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <expired-key> command works for me. Great! Thanks
    – Abhi
    Feb 27, 2022 at 15:07
21

Get the latest (not expired) MySQL APT repository from: https://dev.mysql.com/downloads/repo/apt/

Currently: https://repo.mysql.com//mysql-apt-config_0.8.13-1_all.deb

wget https://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb
sudo apt-get update
sudo apt install mysql-server
2
  • 1
    Thanks, using latest version of repository file works perfectly.
    – Riajul
    Apr 6, 2020 at 6:53
  • This fixed it; unfortunately Oracle doesn't seem to offer a "latest" deb url, meaning that if you are installing this programmatically in a script, you have to manually update the hardcoded file url once a year or so.
    – Mahn
    Dec 27, 2023 at 16:21
3

try running $sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 5072E1F5

source: https://bugs.mysql.com/bug.php?id=85029

2
3

Instruction for apt.

  1. download key

    A. from mysql website https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html

    B. or from public repo shell> gpg --recv-keys 5072E1F5

  2. shell> gpg --import mysql_pubkey.asc

  3. shell> sudo apt-key add mysql_pubkey.asc
2
  • 1
    See my answer for a process that works to resolve expired keys regardless of package.
    – Elder Geek
    May 9, 2019 at 19:36
  • none of the answers had "sudo apt-key add <file>" step.. thanks
    – Siddharth
    May 18, 2021 at 12:12
0

The GPG public key is not correct here. Need to install latest GPG public key again.

Please try

# apt-key adv --keyserver pgp.mit.edu --recv-keys 467B942D3A79BD29

It will install correct MySQL-server GPG key on server then add repo of mysql server

For Ubuntu 22.04 (Jammy)

# echo "deb https://repo.mysql.com/apt/ubuntu/ jammy mysql-apt-config
deb https://repo.mysql.com/apt/ubuntu/ jammy mysql-8.0
deb https://repo.mysql.com/apt/ubuntu/ jammy mysql-tools
deb https://repo.mysql.com/apt/ubuntu/ jammy mysql-cluster-8.0
deb-src https://repo.mysql.com/apt/ubuntu/ jammy mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

For Ubuntu 20.04 (Focal):

# echo "deb https://repo.mysql.com/apt/ubuntu/ focal mysql-apt-config
deb https://repo.mysql.com/apt/ubuntu/ focal mysql-8.0
deb https://repo.mysql.com/apt/ubuntu/ focal mysql-tools
deb https://repo.mysql.com/apt/ubuntu/ focal mysql-cluster-8.0
deb-src https://repo.mysql.com/apt/ubuntu/ focal mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

For Ubuntu 18.04 (Bionic):

# echo "deb https://repo.mysql.com/apt/ubuntu/ bionic mysql-apt-config
deb https://repo.mysql.com/apt/ubuntu/ bionic mysql-8.0
deb https://repo.mysql.com/apt/ubuntu/ bionic mysql-tools
deb https://repo.mysql.com/apt/ubuntu/ bionic mysql-cluster-8.0
deb-src https://repo.mysql.com/apt/ubuntu/ bionic mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

For Ubuntu 16.04 (Xenial):

# echo "deb https://repo.mysql.com/apt/ubuntu/ xenial mysql-apt-config
deb https://repo.mysql.com/apt/ubuntu/ xenial mysql-8.0
deb https://repo.mysql.com/apt/ubuntu/ xenial mysql-tools
deb https://repo.mysql.com/apt/ubuntu/ xenial mysql-cluster-8.0
deb-src https://repo.mysql.com/apt/ubuntu/ xenial mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.0.list

Then run

# apt update
# apt install mysql-server

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .