有人问过类似的问题部分升级--为什么要删除 MariaDB?。该问题的答案基本上是说 dist-upgrade 是问题所在。这个问题是问是否有一些解决方法(或修复)。
有时需要进行 dist-upgrade,而不仅仅是升级。
我们可以更改 sources.list(或其他地方)中的某些内容来告诉 Ubuntu 不要删除 MariaDB 吗?
marc@db01:~$ dpkg --get-selections | grep mysql
libdbd-mysql-perl install
libmysqlclient18 install
mysql-common install
marc@db01:~$ dpkg --get-selections | grep maria
libmariadbclient18 install
mariadb-client-10.0 deinstall
mariadb-client-5.5 install
mariadb-client-core-5.5 install
mariadb-common install
mariadb-server install
mariadb-server-10.0 deinstall
mariadb-server-5.5 install
mariadb-server-core-5.5 install
marc@db01:~$ sudo apt-get check
Reading package lists... Done
Building dependency tree
Reading state information... Done
marc@db01:~$ dpkg --list | grep mysql
ii libdbd-mysql-perl 4.020-1build2 Perl5 database interface to the MySQL database
ii libmysqlclient18 5.5.34+maria-1~precise Virtual package to satisfy external depends
ii mariadb-common 5.5.34+maria-1~precise MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
ii mysql-common 5.5.34+maria-1~precise MariaDB database common files (e.g. /etc/mysql/my.cnf)
marc@db01:~$ sudo apt-get dist-upgrade -o Debug::pkgProblemResolver=true -o Debug::pkgProblemResolver::ShowScores=true
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Starting
Settings used to calculate pkgProblemResolver::Scores::
Important => 3
Required => 2
Standard => 1
Optional => -1
Extra => -2
Essentials => 100
InstalledAndNotObsolete => 1
Depends => 1
Recommends => 1
AddProtected => 10000
AddEssential => 5000
Show Scores
10000 linux-image-3.8.0-29-generic [ amd64 ] < 3.8.0-29.42~precise1 > ( kernel )
6306 dpkg [ amd64 ] < 1.16.1.2ubuntu7.2 > ( admin )
5409 libc-bin [ amd64 ] < 2.15-0ubuntu10.5 > ( libs )
5371 debianutils [ amd64 ] < 4.2.1ubuntu2 > ( utils )
53 libsqlite3-0 [ amd64 ] < 3.7.9-2ubuntu1.1 > ( libs )
10 mariadb-common [ amd64 ] < 5.5.34+maria-1~precise > ( database )
8 mysql-common [ amd64 ] < 5.5.34+maria-1~precise -> 5.5.35-0ubuntu0.12.04.1 > (database )
6 libmariadbclient18 [ amd64 ] < 5.5.34+maria-1~precise > ( libs )
6 libmysqlclient18 [ amd64 ] < 5.5.34+maria-1~precise -> 5.5.35-0ubuntu0.12.04.1 > ( libs )
2 mariadb-client-5.5 [ amd64 ] < 5.5.34+maria-1~precise > ( misc )
2 mariadb-server-core-5.5 [ amd64 ] < 5.5.34+maria-1~precise > ( misc )
2 mariadb-client-core-5.5 [ amd64 ] < 5.5.34+maria-1~precise > ( misc )
1 mariadb-server-5.5 [ amd64 ] < 5.5.34+maria-1~precise > ( misc )
Starting 2
Investigating (0) mysql-common [ amd64 ] < 5.5.34+maria-1~precise -> 5.5.35-0ubuntu0.12.04.1 > ( database )
Broken mysql-common:amd64 Breaks on mysql-client-5.1 [ amd64 ] < none > ( none )
Conflicts//Breaks against version 10.0.7+maria-1~precise for mariadb-client-10.0 but that is not InstVer, ignoring
Considering mariadb-client-5.5:amd64 2 as a solution to mysql-common:amd64 8
Added mariadb-client-5.5:amd64 to the remove list
Broken mysql-common:amd64 Breaks on mysql-client-core-5.1 [ amd64 ] < none > ( none )
Considering mariadb-client-core-5.5:amd64 2 as a solution to mysql-common:amd64 8
Added mariadb-client-core-5.5:amd64 to the remove list
Broken mysql-common:amd64 Breaks on mysql-server-core-5.1 [ amd64 ] < none > ( none )
Considering mariadb-server-core-5.5:amd64 2 as a solution to mysql-common:amd64 8
Added mariadb-server-core-5.5:amd64 to the remove list
Conflicts//Breaks against version 5.5.34+maria-1~precise for mariadb-galera-server-5.5 but that is not InstVer, ignoring
Fixing mysql-common:amd64 via remove of mariadb-client-5.5:amd64
Fixing mysql-common:amd64 via remove of mariadb-client-core-5.5:amd64
Fixing mysql-common:amd64 via remove of mariadb-server-core-5.5:amd64
Investigating (0) libmariadbclient18 [ amd64 ] < 5.5.34+maria-1~precise > ( libs )
Broken libmariadbclient18:amd64 Depends on libmysqlclient18 [ amd64 ] < 5.5.34+maria-1~precise -> 5.5.35-0ubuntu0.12.04.1 > ( libs ) (= 5.5.34+maria-1~precise)
Considering libmysqlclient18:amd64 6 as a solution to libmariadbclient18:amd64 6
Removing libmariadbclient18:amd64 rather than change libmysqlclient18:amd64
Investigating (0) mariadb-server-5.5 [ amd64 ] < 5.5.34+maria-1~precise > ( misc )
Broken mariadb-server-5.5:amd64 Depends on mariadb-client-5.5 [ amd64 ] < 5.5.34+maria-1~precise > ( misc ) (>= 5.5.34+maria-1~precise)
Considering mariadb-client-5.5:amd64 2 as a solution to mariadb-server-5.5:amd64 1
Removing mariadb-server-5.5:amd64 rather than change mariadb-client-5.5:amd64
Investigating (0) mariadb-server [ amd64 ] < 5.5.34+maria-1~precise > ( database )
Broken mariadb-server:amd64 Depends on mariadb-server-5.5 [ amd64 ] < 5.5.34+maria-1~precise > ( misc ) (= 5.5.34+maria-1~precise)
Considering mariadb-server-5.5:amd64 1 as a solution to mariadb-server:amd64 0
Removing mariadb-server:amd64 rather than change mariadb-server-5.5:amd64
Done
Done
The following packages will be REMOVED:
libmariadbclient18 mariadb-client-5.5 mariadb-client-core-5.5 mariadb-server
mariadb-server-5.5 mariadb-server-core-5.5
The following packages will be upgraded:
libmysqlclient18 mysql-common
2 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
Need to get 957 kB of archives.
After this operation, 107 MB disk space will be freed.
Do you want to continue [Y/n]? n
Abort.
marc@db01:~$
现在 MariaDB 已经更新了其 PPA:
marc@db01:~$ apt-cache show mysql-common | grep Version
Version: 5.5.35+maria-1~precise
Version: 5.5.35-0ubuntu0.12.04.2
Version: 5.5.35-0ubuntu0.12.04.1
Version: 5.5.22-0ubuntu1
marc@db01:~$ apt-cache show libmysqlclient18 | grep Version
Version: 5.5.35+maria-1~precise
Version: 5.5.35-0ubuntu0.12.04.2
Version: 5.5.35-0ubuntu0.12.04.1
Version: 5.5.22-0ubuntu1
marc@db01:~$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
答案1
损坏的 mysql-common:amd64 在 mysql-client-5.1 [ amd64 ] 上损坏(无) 冲突//与 mariadb-client-10.0 版本 10.0.7+maria-1~precise 不兼容但这不是 InstVer,忽略 考虑使用 mariadb-client-5.5:amd64 2 作为 mysql-common:amd64 8 的解决方案 将 mariadb-client-5.5:amd64 添加到删除列表
可以看出,如果您尝试升级 mysql,MariaDB 会中断。您sudo apt-get upgrade
暂时只能依靠 来防止 MariaDB 被删除。
答案2
MariaDB 在安装 deb 软件包的文章中介绍了这个问题,解决这个问题的最佳方法是固定 MariaDB 仓库。您可以按照以下说明进行操作:https://mariadb.com/kb/en/installing-mariadb-deb-files/#pinning-the-mariadb-repository (如果你向上滚动他们还会解释为什么会发生这种情况)
答案3
如果您在 Debian 9 上遇到此问题,请使用以下来源:
# MariaDB 10.4 for Debian 9
deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main
deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main