MySQL - 无法在 Ubuntu 22.04.1 上从 8.0.30 更新至 8.0.31

MySQL - 无法在 Ubuntu 22.04.1 上从 8.0.30 更新至 8.0.31

我有两个更新无法自动安装。

当我尝试使用以下命令升级时:sudo apt upgrade我收到此消息:

以下软件包已被保留:mysql-client mysql-server

因此,当我尝试手动安装它时:sudo apt install mysql-client然后我收到以下消息:

The following packages have unmet dependencies: 
mysql-common : Conflicts: mysql-client-8.0 but 8.0.31-0ubuntu0.22.04.1 is to be installed 
               Conflicts: mysql-client-core-8.0 but 8.0.31-0ubuntu0.22.04.1 is to be installed 
E: Unable to correct problems, you have held broken packages.

当我尝试安装时:sudo apt install mysql-server

我收到此消息:

The following packages have unmet dependencies: 
mysql-common : Conflicts: mysql-server-8.0 but 8.0.31-0ubuntu0.22.04.1 is to be installed
mysql-community-client : Conflicts: mysql-server-8.0 but 8.0.31-0ubuntu0.22.04.1 is to be installed 
mysql-server-8.0 : Depends: mysql-client-8.0 (>= 8.0.31-0ubuntu0.22.04.1) but it is not installable 
                   Depends: mysql-server-core-8.0 (= 8.0.31-0ubuntu0.22.04.1) but it is not installable 
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

它位于生产服务器上,如果可以不删除所有内容并重新安装 mysql,而不会丢失我的配置和/或删除数据库。

更新:

输出~$ apt-cache policy mysql-client-8.0

mysql-client-8.0:
  Installed: (none)
  Candidate: 8.0.31-0ubuntu0.22.04.1
  Version table:
     8.0.31-0ubuntu0.22.04.1 500
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages
     8.0.28-0ubuntu4 500
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

输出~$ apt-cache policy mysql-server-core-8.0

mysql-server-core-8.0:
  Installed: (none)
  Candidate: 8.0.31-0ubuntu0.22.04.1
  Version table:
     8.0.31-0ubuntu0.22.04.1 500
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages
     8.0.28-0ubuntu4 500
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

输出~$ sudo apt upgrade

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
#
# News about significant security updates, features and services will
# appear here to raise awareness and perhaps tease /r/Linux ;)
# Use 'pro config set apt_news=false' to hide this and future APT news.
#
The following packages have been kept back:
  mysql-client mysql-server
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

答案1

线索就在这个错误信息中

mysql-community-client : Conflicts: mysql-server-8.0 but 8.0.31-0ubuntu0.22.04.1 is to be installed 

您已安装该软件包mysql-community-client。这是一个命令行客户端,其用途与该软件包相同,mysql-client但(我认为)属于不同的许可证。

尽管如此,它的存在会导致服务器安装失败。因此,只需将其删除,然后重新尝试安装服务器即可。

此后,请确保始终安装一个 MySQL 客户端以进行基本维护,无论是mysql-client还是mysql-communit-client

答案2

这对我有用(zabbix 6.2.7 Ubuntu 22.04)。

sudo apt purge mysql-community-client  
sudo apt purge  mysql-common  
sudo apt install mysql-client  
sudo apt install zabbix-server-mysql  

设置 mysql 密码为/etc/zabbix/zabbix_server.conf

重启服务器。

相关内容