我正在尝试安装 mysql,但由于以下错误而无法安装:
set@set-home ~ $ sudo apt-get install mysql-server -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libstdc++6:i386 : Breaks: libstdc++6 (!= 8.1.0-5ubuntu1~14.04) but 8.2.0-9 is to be installed
libstdc++6 : Depends: gcc-8-base (= 8.2.0-9) but 8.1.0-5ubuntu1~14.04 is to be installed
Breaks: libboost-date-time1.54.0 but 1.54.0-4ubuntu3.1 is to be installed
Breaks: libstdc++6:i386 (!= 8.2.0-9) but 8.1.0-5ubuntu1~14.04 is to be installed
mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
我努力了:
- sudo apt-get -f 安装
- sudo apt-get -u dist-upgrade
- sudo apt-get 自动清理
- sudo apt-get clean
但这一切都没有成功。我该如何解决这个问题?
答案1
让我们看看 Ubuntu 存储库中可用的软件包libstdc++6
:
$ rmadison libstdc++6 // The rmadison command is provided by the 'devscripts' package
libstdc++6 | 4.6.3-1ubuntu5 | precise | amd64, armel, armhf, i386, powerpc
libstdc++6 | 4.8.2-19ubuntu1 | trusty | amd64, arm64, armhf, i386, powerpc, ppc64el
libstdc++6 | 4.8.4-2ubuntu1~14.04.4 | trusty-security | amd64, arm64, armhf, i386, powerpc, ppc64el
libstdc++6 | 4.8.4-2ubuntu1~14.04.4 | trusty-updates | amd64, arm64, armhf, i386, powerpc, ppc64el
libstdc++6 | 5.3.1-14ubuntu2 | xenial | amd64, arm64, armhf, i386, powerpc, ppc64el, s390x
libstdc++6 | 5.4.0-6ubuntu1~16.04.10 | xenial-security | amd64, arm64, armhf, i386, powerpc, ppc64el, s390x
libstdc++6 | 5.4.0-6ubuntu1~16.04.11 | xenial-proposed | amd64, arm64, armhf, i386, powerpc, ppc64el, s390x
libstdc++6 | 5.4.0-6ubuntu1~16.04.11 | xenial-updates | amd64, arm64, armhf, i386, powerpc, ppc64el, s390x
libstdc++6 | 8-20180414-1ubuntu2 | bionic | amd64, arm64, armhf, i386, ppc64el, s390x
libstdc++6 | 8.2.0-1ubuntu2~18.04 | bionic-updates | amd64, arm64, armhf, i386, ppc64el, s390x
libstdc++6 | 8.2.0-7ubuntu1 | cosmic | amd64, arm64, armhf, i386, ppc64el, s390x
libstdc++6 | 8.2.0-12ubuntu1 | disco | amd64, arm64, armhf, i386, ppc64el, s390x
libstdc++6 | 8.2.0-13ubuntu1 | disco-proposed | amd64, arm64, armhf, i386, ppc64el, s390x
啊哈。您的两个选项 8.1.0-5ubuntu1~14.04 和 8.2.0-9 都不是来自 Ubuntu 存储库。
现在我们知道问题所在了:你不明智地添加了非 Ubuntu 源,这些源提供的软件包不相容与您的 Ubuntu 版本有关。这也被称为“版本冲突”或“持有损坏的软件包”。它们实际上并不是“损坏的”,只是版本错误……但它们确实会破坏您的系统。
解决方案是卸载来自该不明智来源的所有软件包,然后删除该来源。将系统恢复为使用 Ubuntu 存储库提供的软件包。然后 MySQL 将安装。
如果你不知道如何从特定源卸载软件包,请参阅如何删除 PPA?有关如何安装和使用该ppa-purge
命令的说明。