如何从 archive.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/ 添加 mysql-8.0 存储库

如何从 archive.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/ 添加 mysql-8.0 存储库

MySQL8 官方仓库https://repo.mysql.com/apt/不起作用。如何添加archive.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/到 Ubuntu 18.04 Bionic 的源列表以设置 MySQL8?

我正在尝试将下一个列表添加到/etc/apt/sources.list.d/mysql.list

deb http://ua.archive.ubuntu.com/ubuntu/pool/main  bionic main
deb-src http://ua.archive.ubuntu.com/ubuntu/pool/main bionic main

但它不起作用

答案1

第一种方法:

wget https://repo.mysql.com/mysql-apt-config_0.8.9-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.9-1_all.deb

将出现文本窗口:

  • 选择 Xenial 作为最新并点击Enter
  • 选择MySQL Server & Cluster (Currently selected: mysql-5.7)并点击Enter
  • 选择mysql-8.0 preview并点击Enter
  • 选择OK并按下

但您可能会在过程中收到以下错误sudo apt update

Err:3 http://repo.mysql.com/apt/ubuntu xenial InRelease
  The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <[email protected]>
Reading package lists... Done               
W: GPG error: http://repo.mysql.com/apt/ubuntu xenial InRelease: The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <[email protected]>
E: The repository 'http://repo.mysql.com/apt/ubuntu xenial 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.

要消除这些错误,请删除新添加的存储库文件:

sudo rm /etc/apt/sources.list.d/mysql.list

所以尝试第二种方法。

如果第一种方法不行,可以采用第二种方法:

/etc/apt/sources.list看起来应该是这样的:

deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse

如果你的服务器用于学习和测试目的,可能会出现操作系统依赖性问题和系统崩溃,那么你可以尝试将以下内容添加到你的sources.list

deb http://ru.archive.ubuntu.com/ubuntu/ eoan main restricted

然后sudo apt update && sudo apt install mysql-server-8.0

mysql-server-8.0软件包安装过程中,将已安装软件包的信息复制到某处,以便能够在 eoan 的存储库注释后删除它们并安装支持的版本。它可能会删除稳定系统处理所需的其他软件包。因此,请准备好恢复或重新安装您的系统。

mysql-server 安装后

  • 注释掉eoan存储库记录
  • sudo apt clean && sudo apt update

要恢复正常配置:

  • sudo apt purge mysql-server-8.0 && sudo apt autoremove
  • 评论或删除eoan记录sources.list
  • sudo apt update && sudo apt install -f && sudo apt upgrade

相关内容