How to fix MySQL APT EXPKEYSIG B7B3B788A8D3785C
When attempting to upgrade packages from the MySQL APT repository:
sudo apt update
The error below may appear when you run sudo apt update.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repo.mysql.com/apt/ubuntu focal InRelease: The following signatures were invalid: EXPKEYSIG B7B3B788A8D3785C MySQL Release Engineering <mysql-build@oss.oracle.com>
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease Connection failed [IP: 2a06:bc80:0:1000::17 80]
W: Failed to fetch http://repo.mysql.com/apt/ubuntu/dists/focal/InRelease The following signatures were invalid: EXPKEYSIG B7B3B788A8D3785C MySQL Release Engineering <mysql-build@oss.oracle.com>
The cause is an expired signing key. The quickest fix is to reinstall the MySQL APT configuration package (mysql-apt-config). Download the .deb from MySQL’s APT repository.
curl -O https://repo.mysql.com/mysql-apt-config_0.8.36-1_all.deb
Then install it.
sudo dpkg -i mysql-apt-config_0.8.36-1_all.deb
In the configuration dialog, press the Down Arrow key twice, leave Ok selected, and press Enter.
┌─────────────────────────────────┤ Configuring mysql-apt-config ├──────────────────────────────────────┐
│ The MySQL APT Repository features MySQL Server along with a variety of components. You may select the │
│ desired products to install and update from the official MySQL Repository, and also select the │
│ associated version series. │
│ │
│ Select "Ok" to save the configuration, and then execute "apt update" to load the selected package │
| list. This configuration can be updated later, depending on your needs. │
│ │
│ Which MySQL product do you wish to configure? │
│ │
│ MySQL Server & Cluster (Currently selected: mysql-8.0) │
│ MySQL Connectors (Currently selected: Enabled) │
│ --> Ok │
│ │
│ │
│ <Ok> │
│ │
└───────────────────────────────────────────────────────────────────────────────────────────────────────┘
The signing key is refreshed. After that, sudo apt update should work normally.