在 ubuntu 19.10 机器上安装 mysql-server 5.7 而不是 mysql-server 8.0

在 ubuntu 19.10 机器上安装 mysql-server 5.7 而不是 mysql-server 8.0

我在 ubuntu 19.10 (eoan) 机器上安装 mysql-server 5.7 时遇到了一些问题。不幸的是,我只能使用 mysql-server 版本 5.6/5.7,因此仅安装 mysql-server 8.0 是不可能的。

根据之前在早期 ubuntu 版本上的尝试,我添加了 mysql-server 5.7 的 mysql 存储库。结果如下:

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

### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out entries below, but any other modifications may be lost.
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-apt-config
deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7
deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools
# deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools-preview
deb-src http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7

完成此操作后,我运行以下命令。

sudo apt update

....
Hit:1 http://repo.mysql.com/apt/ubuntu bionic InRelease
....

更新机器上的所有存储库后,我运行命令来安装 mysql-server 5.7。

sudo apt install mysql-server

.....
The following additional packages will be installed:
mysql-client-8.0 mysql-client-core-8.0 mysql-server-8.0 mysql-server-core-8.0

从上面的输出可以看出,ubuntu 仍在尝试安装 mysql-server 8.0 版本。这不是我需要的。

我还尝试通过下载.deb 文件手动安装 mysql-server 5.7,但这导致依赖性混乱,无法安装。

下面我列出了的内容/etc/apt/sources.list,我通过执行一系列 dist-upgrades 命令安装了 Ubuntu 19.10。(正如你从注释掉的行中看到的那样。)

总结

我无法在 ubuntu 19.10 机器上安装 mysql-server 5.7(通过执行一系列 dist 升级命令安装了 19.10)。我添加了 mysql 5.7 repo 并运行了更新命令,但仍然没有成功。Ubuntu 仍然尝试安装 mysql-server 8.0。

有人有建议阻止安装 mysql-server 8.0 并安装 mysql 5.7 吗(我需要安装 mysql 5.6/5.7 我不能使用 mysql-server 8.0)

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://nl.archive.ubuntu.com/ubuntu/ eoan main restricted
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://nl.archive.ubuntu.com/ubuntu/ eoan-updates main restricted
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://nl.archive.ubuntu.com/ubuntu/ eoan universe
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful universe
deb http://nl.archive.ubuntu.com/ubuntu/ eoan-updates universe
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://nl.archive.ubuntu.com/ubuntu/ eoan multiverse
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful multiverse
deb http://nl.archive.ubuntu.com/ubuntu/ eoan-updates multiverse
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://nl.archive.ubuntu.com/ubuntu/ eoan-backports main restricted universe multiverse
# deb-src http://nl.archive.ubuntu.com/ubuntu/ artful-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu artful partner
# deb-src http://archive.canonical.com/ubuntu artful partner

deb http://security.ubuntu.com/ubuntu eoan-security main restricted
# deb-src http://security.ubuntu.com/ubuntu artful-security main restricted
deb http://security.ubuntu.com/ubuntu eoan-security universe
# deb-src http://security.ubuntu.com/ubuntu artful-security universe
deb http://security.ubuntu.com/ubuntu eoan-security multiverse
# deb-src http://security.ubuntu.com/ubuntu artful-security multiverse

答案1

我找到了以下在 ubuntu 19.10 上安装 mysql-server 5.7 的解决方案。

  1. 配置 apt 以包含 mysql 5.7 的 mysql 存储库,请参阅:mysql-apt-config_0.8.12-1_all.deb,您可以按照此处的相同说明进行操作:MySQL APT 存储库配置,确保运行时mysql-apt-config-0.8.12-1_all.deb选择MySQL 5.7版本。

  2. 确保运行sudo apt update。运行此命令后运行命令:sudo apt policy mysql-server

输出应该与下面列出的输出非常相似:

  Installed: None
  Candidate: 8.0.17-0ubuntu2
  Version table:
     8.0.17-0ubuntu2 500
        500 http://nl.archive.ubuntu.com/ubuntu eoan/main amd64 Packages
        500 http://nl.archive.ubuntu.com/ubuntu eoan/main i386 Packages
     5.7.28-1ubuntu18.04 500
        500 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 Packages
        100 /var/lib/dpkg/status

下面的输出现在列出了该mysql-server软件包的两个版本。ubuntu 19.10 的默认候选版本是mysql-server 8.0.17-0ubuntu2

第二个包是来自上面新添加的存储库的包。对我来说,这是mysql-server 5.7.28-1ubuntu18.04

  1. 要安装 mysql-server 包的另一个版本(默认版本除外),我运行以下命令:

sudo apt install mysql-server=<version-tag>

例子:

sudo apt install mysql-server=5.7.28-1ubuntu18.04

首先,这引发了软件包的依赖性问题,但我通过遵循软件包mysql-client步骤中的相同说明解决了这个问题。2mysql-client

相关内容