The following signatures couldn‘t be verified because the public key is not available: NO_PUBKEY B7B

W: GPG error: http://repo.mysql.com/apt/ubuntu jammy 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 jammy 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.

你在 Ubuntu Jammy (22.04) 上遇到了 GPG 错误,主要是因为 MySQL 仓库的公钥丢失或未正确导入

这是一个常见的问题,可以通过重新添加 MySQL GPG 公钥 来修复。

解决方法:手动添加 MySQL GPG 公钥

1️⃣ 移除旧的 GPG 密钥

首先,确保删除旧的 MySQL GPG 密钥:

sudo apt-key del B7B3B788A8D3785C
2️⃣ 导入新的 MySQL 公钥

Ubuntu 现在推荐使用 gpg 方式来导入新的密钥:

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 | sudo gpg --dearmor -o /etc/apt/keyrings/mysql.gpg
3️⃣ 更新 MySQL 仓库配置

编辑 MySQL 的仓库文件,将公钥路径更新为新的位置:

echo "deb [signed-by=/etc/apt/keyrings/mysql.gpg] http://repo.mysql.com/apt/ubuntu jammy mysql-apt-config" | sudo tee /etc/apt/sources.list.d/mysql.list
4️⃣ 更新系统包列表

运行以下命令更新包列表:

sudo apt update

🛠 如果问题依然存在,可以尝试的替代方案

🔄 使用 apt-key 命令导入公钥

如果你的系统依然支持 apt-key 命令,可以尝试使用以下方式:

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

🎉 修复完成后,验证

运行以下命令验证 MySQL 仓库是否正常:

sudo apt update
sudo apt install mysql-server

如果仍有问题

  • 查看 /etc/apt/sources.list.d/mysql.list 文件内容
  • 确认文件中路径与密钥路径一致
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

十方来财

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值