Invalid Signature for MySQL repository
Asked Answered
D

5

21

I really hope you can help me as i've tried to find a solution myself for like 3 hours or so. I basically went through every stackoverflow post there was regarding this.

What i'm trying to do is i want to apt-get update on my Debian Linux 10 environment.

Every time i try to run this this comes up:

Get:1 http://repo.mysql.com/apt stable InRelease [3,566 B]
Get:2 https://packages.sury.org/php buster InRelease [6,771 B]
Err:1 http://repo.mysql.com/apt stable InRelease
  The following signatures were invalid: A4A9406876FCBD3C456770C88C718D3B5072E1F5
Get:3 https://packages.sury.org/php buster/main i386 Packages [282 kB]
Reading package lists... Done
W: GPG error: http://repo.mysql.com/apt stable InRelease: The following signatures were invalid: 
A4A9406876FCBD3C456770C88C718D3B5072E1F5
E: The repository 'http://repo.mysql.com/apt stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

I have tried everything i found on stackoverflow and on the MySQL forum. I really hope you can help me.

Thanks in advance.

Deserve answered 27/2, 2021 at 15:19 Comment(1)
I had to install MySQL on Ubuntu through a different method: askubuntu.com/questions/1259242/…Cussed
G
32

Was getting similar error

Err:2 http://repo.mysql.com/apt/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29
Fetched 20.0 kB in 1s (26.1 kB/s)

Try to remove the previous key and add it again:

$ sudo apt-key list

/etc/apt/trusted.gpg
--------------------
pub   rsa4096 2021-12-14 [SC] [expires: 2023-12-14]
      859B E8D7 C586 F538 430B  19C2 467B 942D 3A79 BD29
uid           [ unknown] MySQL Release Engineering <[email protected]>
sub   rsa4096 2021-12-14 [E] [expires: 2023-12-14]
sudo apt-key del A4A9 4068 76FC BD3C 4567  70C8 8C71 8D3B 5072 E1F5                                                                                                                                                                                                                                          
sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 467B942D3A79BD29

After that sudo apt-get update is working fine.

Greece answered 14/3, 2022 at 12:19 Comment(3)
+1 because your answer was part of the solution. However, for deleting the key, you'll have to put it in quotes because of the space characters. For example: sudo apt-key del 'A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5'Naominaor
Just worked without quotes for me?Asafoetida
it works deleting the spaces too (Ubuntu 24.04)Hymn
V
7

try this

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B7B3B788A8D3785C
Visconti answered 3/1, 2024 at 12:20 Comment(2)
Please add some explanation to your answer such that others can learn from it. Why should importing a completely different key resolve the problem?Stairhead
Not sure why, but this is the only answer that worked for me.Runagate
H
5

Considering that the mysql-server on your machine is installed through APT repositories, you can solve this problem by installing MySQL's APT configurator.

Apparently, the GPG key is reconfigured once mysql-apt-config.deb is installed.


Resources: upgrading mysql though APT repositories

Hymenopteran answered 18/12, 2023 at 8:32 Comment(2)
Download the aforesaid .deb file, installed it using dpkg and tried updating. The problem's gone! Thank you.Daze
This is the only thing that worked for me.Appendicular
E
3

I just had a similar problem and found an answer here. The signature key expired.

Try running the following command:

sudo apt-key adv --keyserver keys.gnupg.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5

Engvall answered 2/3, 2021 at 13:5 Comment(2)
When i try that this comes back: Executing: /tmp/apt-key-gpghome.00F6EFHTL2/gpg.1.sh --keyserver keys.gnupg.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 gpg: key 8C718D3B5072E1F5: 3 duplicate signatures removed gpg: key 8C718D3B5072E1F5: "MySQL Release Engineering <[email protected]>" not changed gpg: Total number processed: 1 gpg: unchanged: 1 And then apt-get update still doesn't work.Deserve
@Deserve I'm getting the same error as you with the unchanged: 1 and the update doesn't work. were you able to find a solution?Parole
S
1

None of the answers provided worked for me. I'm running Ubuntu 20.04.6 LTS, but I need to run MySQL 5.7. This was possible using an older mysql-apt-config (0.8.24-1). See https://askubuntu.com/questions/1232558/install-mysql-5-7-on-ubuntu-20-04 - the post mentions 0.8.10, but it works up to 0.8.24.

After October 2023, this method will not work because the PGP key used is not public or has been forgotten to be published.

However, you can manually import the PGP key:

wget -qO - https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 | sudo apt-key add -

(see https://repo.mysql.com/ for a list of available keys, choose the most recent one)

After that, apt-get update works again, however mysql-apt-config was updated to the latest version in the process. I had to remove it and re-install mysql-apt-config_0.8.24-1_all.deb from my local copy.

Spectacle answered 9/1, 2024 at 7:58 Comment(2)
I can't access wget without a apt-get update... so how do you first wget to be able to use apt-get update?Souter
Sorry, I keep forgetting wget isn't everywhere. curl works too (curl -O https://repo.mysql.com/RPM-GPG-KEY-mysql-2023), or you fetch the file via browser and copy it to the server manually. Once the file is on the server, cd to the location and import it like this: cat RPM-GPG-KEY-mysql-2023 | sudo apt-key add -Spectacle

© 2022 - 2025 — McMap. All rights reserved.