在安装mysql8.0的存储库后,执行apt update的时候会出现报错:
Err:1 http://repo.mysql.com/apt/ubuntu bionic InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B7B3B788A8D3785C
root@ubuntu18:~# apt update
Get:1 http://repo.mysql.com/apt/ubuntu bionic InRelease [20.0 kB]
Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Err:1 http://repo.mysql.com/apt/ubuntu bionic InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B7B3B788A8D3785C
Hit:3 https://repo.zabbix.com/zabbix-agent2-plugins/1/ubuntu bionic InRelease
Hit:4 https://repo.zabbix.com/zabbix/6.0/ubuntu bionic InRelease
Hit:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease
Hit:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease
Hit:7 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports InRelease
Reading package lists... Done
W: GPG error: http://repo.mysql.com/apt/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B7B3B788A8D3785C
E: The repository 'http://repo.mysql.com/apt/ubuntu bionic 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.
我们看报错有key的id为;B7B3B788A8D3785C
期间试过很多方式都拉取不下来,最终找到解决方法为:手动去下载key文件并添加到Mysql的存储库中:
复制邮箱打开网站:http://keyserver.ubuntu.com/
在search里面输入:[email protected]
进入后,按键盘的ctrl+f:输入B7B3B788A8D3785C
然后找到B7B3B788A8D3785C文件进行下载
然后在自己电脑下载目录找到那个文件,然后右击以记事本方式打开查看内容,复制全部内容:
再去到服务器中添加key:
vim mysql_gpgkey //打开文件,然后将刚刚复制的key内容粘贴到里面
sudo apt-key add mysql_gpgkey //添加key
添加完后,去查看一下有没有添加成功!:
最后再去执行
apt-get update
添加mysql8.0的key成功!