29

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

我已按照https://askubuntu.com/questions/64772/how-to-install-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。

4

8 回答 8

34
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 实际上会警告您有问题。

为防止此问题再次出现,请通过在以下位置创建文件来告诉 apt通过 pinning 支持 MariaDB/etc/apt/preferences.d存储库:

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

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

于 2013-04-26T09:04:52.457 回答
9

我做了类似于@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.

我收到了 Plugin Disabled 警告,但是在重新启动 mysqlsudo service mysql restart并安装我的 sql 时,innodb 似乎很好并且按预期show create table mytable显示。ENGINE=InnoDB DEFAULT CHARSET=utf8

于 2013-04-28T18:07:19.860 回答
4

@yuvlio 说得对:

$ 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 对内核已更新到 3.5.0-25 之类的任何地方“敏感”,这似乎会影响使用普通香草“sudo apt-get install mariadb-server”安装 MariaDB

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

这很有意义,因为 MariaDB 使用 XTRA-DB 作为 InnoDB 的替代品。大概 MariaDB 也有一个新的反馈模块(他们希望 MariaDB 反馈到 mariadb.org 而不是 Oracle/mySQL)

于 2013-05-02T17:23:31.670 回答
4

@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的错误。

于 2013-07-10T14:25:43.860 回答
2

尝试

sudo dpkg --remove --force-remove-reinstreq BROKEN_PACKAGE
于 2013-04-25T13:04:49.443 回答
2

让我分享一下我在我的案例中是如何解决的(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

笔记:

于 2015-01-22T07:16:58.260 回答
2

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

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

apt-get remove mariadb-server

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

apt-get remove mariadb-server

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

现在可以了。

于 2014-04-02T20:48:18.160 回答
0

我能够通过删除所有 mysql 包然后运行来安装 mariadb:

    sudo apt-get 安装 mariadb-server-5.5 mariadb-client-5.5 \
    mariadb-server-core-5.5 mariadb-common mariadb-server \
    libmariadbclient18 libdbd-mysql-perl mariadb-client-core-5.5 \
    libmysqlclient18=5.5.30-mariadb1~quantal \
    mysql-common=5.5.30-mariadb1~quantal

我不确定是否需要先删除 mysql。

于 2013-04-26T04:20:21.447 回答