在 Debian 10 上安装 MySQL 8.0 时出错

在 Debian 10 上安装 MySQL 8.0 时出错

我正在尝试在 Debian 10 上安装 MySQL,我按照说明进行操作,但出现以下错误。有人能帮我解决这个问题吗?

matt@debian:~$ sudo apt install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mysql-server : Depends: mysql-community-server (= 8.0.17-1debian10) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

答案1

  1. 使用命令检查附加的存储库apt policy。删除旧存储库或实现发布名称。
  2. 清理包缓存(apt clean)。
  3. 更新软件包列表(apt update)。
  4. 使用 检查包的当前状态apt-get check
  5. 搜索合适的包(apt search mysql-server)。
  6. 检查您的包裹的政策(apt policy mysql-serverapt policy mysql-community-server)。
  7. 可能的问题是由源列表中某处被遗忘的记录引起的。

答案2

我因为 apt pin 遇到了同样的问题。将 mysql pin 优先级设置为 900 解决了我的问题

#/etc/apt/preferences.d/mysql.pref

Package: *
Pin: release o=MySQL
Pin-Priority: 900

答案3

本教程https://www.linuxcapable.com/how-to-install-mysql-8-0-on-debian-linux/帮助我解决了这样的问题(Debian 10)

步骤 1:在安装 MySQL 8.0 之前更新 Debian

sudo apt 更新 && sudo apt 升级

第 2 步:安装 MySQL 8.0 所需的软件包

sudo apt install dirmngr 软件属性-通用 apt-transport-https curl lsb-release ca-certificates -y

步骤 3:导入 MySQL 社区存储库

curl-fsSLhttps://repo.mysql.com/RPM-GPG-KEY-mysql-2022| gpg --dearmor | sudo tee /usr/share/keyrings/mysql.gpg > /dev/null

回显“deb [signed-by=/usr/share/keyrings/mysql.gpg]http://repo.mysql.com/apt/debian$(lsb_release -sc) mysql-8.0” | sudo tee /etc/apt/sources.list.d/mysql.list

步骤 4:通过 APT 命令在 Debian 上安装 MySQL 8.0

sudo apt 安装 mysql-community-server

相关内容