当前位置: 首页>>技术教程>>正文


安装MariaDB – 未安装的依赖项,mariadb-server-5.5

, ,

问题描述

我正在尝试在Ubuntu 12.04 LTS上安装MariaDB。

我按照如何安装MariaDB?和MariaDB.org提供的说明选择下载时出现。

最后一步是sudo apt-get install mariadb-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:
 mariadb-server : Depends: mariadb-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

依赖性问题是一个确认问题(https://mariadb.atlassian.net/browse/MDEV-3882),但我相信破坏的包阻止我解决这个问题。

如果我尝试安装libmariadbclient18,我会得到以下内容:

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:
 libmariadbclient18 : Depends: libmysqlclient18 (= 5.5.30-mariadb1~precise) but 5.5.31-0ubuntu0.12.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.

我试图使用sudo apt-get install -f纠正损坏的包,但我仍然无法安装mariadb-server或libmariadbclient18。

最佳解决方法

sudo apt-get install libmysqlclient18=5.5.30-mariadb1~precise mysql-common=5.5.30-mariadb1~precise
sudo apt-get install mariadb-server

第一个将ubuntu端的两个mysql库恢复为较旧的mariadb。然后第二个可以正常进行。

由于运行了类似apt-get dist-upgrade的软件包,因此删除了软件包。 GUI实际上警告你有些不对劲。

要防止此问题再次出现,请通过在/etc/apt/preferences.d中创建文件告诉apt到favor the MariaDB repo via pinning

$ cat /etc/apt/preferences.d/MariaDB.pref
Package: *
Pin: origin <mirror-domain>
Pin-Priority: 1000

另外,如果需要编译任何东西(比如Ruby gems),请务必安装libmariadbclient-dev

次佳解决方法

我做了类似于@Lloeki的事情

$ sudo apt-get purge libmariadbclient18 mariadb-server mariadb-client-5.5 libmysqlclient18 mysql-common```

然后查找候选人安装并重新安装它:

$ apt-cache policy libmysqlclient18 | grep -i quantal 
Installed: 5.5.30-mariadb1~quantal
*** 5.5.30-mariadb1~quantal 0
    500 http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu/ quantal/main amd64 Packages
$ apt-cache policy mysql-common | grep -i quantal 
Installed: 5.5.30-mariadb1~quantal
*** 5.5.30-mariadb1~quantal 0
    500 http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu/ quantal/main amd64 Packages
$ 
$ sudo apt-get install libmysqlclient18=5.5.30-mariadb1~quantal mysql-common=5.5.30-mariadb1~quantal mariadb-server mariadb-client

...
 * Stopping MariaDB database server mysqld                                                              [ OK ] 
130428 13:19:40 [Note] Plugin 'InnoDB' is disabled.
130428 13:19:40 [Note] Plugin 'FEEDBACK' is disabled.

我得到了插件禁用警告,但在用sudo service mysql restart重新启动mysql并安装我的sql时,innodb看起来很好,show create table mytable按预期显示ENGINE=InnoDB DEFAULT CHARSET=utf8

第三种解决方法

@yuvilio说得对:

$ sudo apt-get install libmysqlclient18=5.5.30-mariadb1~quantal mysql-common=5.5.30-mariadb1~quantal mariadb-server mariadb-client

这适用于12.04,12.10和13.04(也是LinuxMint 14)。

显然MariaDB是”sensitive”到内核已经更新的任何地方,如3.5.0-25,这似乎影响使用普通的“sudo apt-get安装mariadb-server”安装MariaDB

@yuvilio提到插件’InnoDB’和’FEEDBACK’被禁用,但InnoDB在此安装后工作。

这非常有意义,因为MariaDB使用XTRA-DB代替InnoDB。据推测MariaDB还有一个新的反馈模块(他们希望MariaDB反馈转到mariadb.org而不是Oracle /mySQL)

第四种方法

@Lloeki的答案对我不起作用了,因为上面提到的版本不适合我,导致出现此错误:

E: Version '5.5.30-mariadb1~precise' for 'libmysqlclient18' was not found

要解决此问题,您需要找到正确的版本:

您可以使用aptitude versions libmysqlclient18获取可用版本的列表。对于我的系统,这看起来像:

Package libmysqlclient18:
[...]
p   5.5.31+maria-1~precise                                         <NULL>                                      1000
i   1:5.5.32-rel31.0-549.precise                                   <NULL>                                      500
[...]    

(还有几行,但只显示了相关的行)。

i的行是当前安装的版本,并且没有建议的5.5.30-mariadb1~precise行。然而,另一位候选人看起来很有希望。请注意,就像我一样,这对你来说不一定(随着时间的推移而变化)。

在此示例中,您可以继续这样:

sudo apt-get install libmysqlclient18=5.5.31+maria-1~precise

然后安装将选择客户端和mariadb-common,您可以继续:

 sudo apt-get install mariadb-server

没有OP的错误。

第五种方法

尝试

sudo dpkg --remove --force-remove-reinstreq BROKEN_PACKAGE

第六种方法

让我分享一下我在案例中的解决方法(Ubuntu 14.04)。

我有错误:

$ sudo apt-get install mariadb-server-5.5
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:
 mariadb-server-5.5 : Depends: mariadb-client-5.5 (>= 5.5.41+maria-1~trusty) but it is not going to be installed
                      Depends: mariadb-server-core-5.5 (>= 5.5.41+maria-1~trusty) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

解:

步骤1:sudo apt-get install libmysqlclient18

步骤2:sudo apt-get install mariadb-server

笔记:

  • 我正在根据这些instructions进行安装

  • 我以前没有安装MySQL

第七种方法

我不知道这是否对任何人都有帮助,但我在安装mariadb 10时遇到了麻烦并且出现了导致我访问此页面的错误,但我没有尝试过任何帮助。

我终于意识到我的/tmp目录是由root拥有的,其他用户无法写入它。我解决了这个问题然后做了:

apt-get remove mariadb-server

尝试再次安装,但删除失败,所以我删除了/var/lib/mysql然后尝试:

apt-get remove mariadb-server

再次,它实际上安装了mariadb-server并启动并运行…

它现在有效。

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/7025.html,未经允许,请勿转载。