Debian

當mysql遇到問題時如何安裝mariadb?

  • July 1, 2015

我在Google上搜尋了一段時間,但從我在虛擬機上遇到的這種奇怪情況似乎沒有什麼明顯的,有人可以幫助我嗎?

root@sathia:/etc/apt# apt-cache policy mariadb-server
mariadb-server:
 Installed: 10.0.20+maria-1~jessie
 Candidate: 10.0.20+maria-1~jessie
 Version table:
*** 10.0.20+maria-1~jessie 0
      1000 http://ftp.osuosl.org/pub/mariadb/repo/10.0/debian/ jessie/main amd64 Packages
       100 /var/lib/dpkg/status
    10.0.16-1 0
       500 http://httpredir.debian.org/debian/ jessie/main amd64 Packages
root@sathia:/etc/apt# apt-get install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
mariadb-server is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
mariadb-client : Depends: mariadb-client-10.0 (= 10.0.20+maria-1~jessie) but 10.0.16-1 is to be installed
mariadb-server : Depends: mariadb-server-10.0 (= 10.0.20+maria-1~jessie) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
root@sathia:/etc/apt# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
 mariadb-client-10.0 mariadb-client-core-10.0 mariadb-server-10.0
Suggested packages:
 tinyca mariadb-test
The following NEW packages will be installed:
 mariadb-server-10.0
The following packages will be upgraded:
 mariadb-client-10.0 mariadb-client-core-10.0
2 upgraded, 1 newly installed, 0 to remove and 9 not upgraded.
6 not fully installed or removed.
Need to get 0 B/7,669 kB of archives.
After this operation, 77.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Reading changelogs... Done
Preconfiguring packages ...
dpkg: regarding .../mariadb-client-core-10.0_10.0.20+maria-1~jessie_amd64.deb containing mariadb-client-core-10.0:
mariadb-client-10.0 conflicts with mysql-client-core-5.5
 mariadb-client-core-10.0 provides mysql-client-core-5.5 and is to be installed.

dpkg: error processing archive /var/cache/apt/archives/mariadb-client-core-10.0_10.0.20+maria-1~jessie_amd64.deb (--unpack):
conflicting packages - not installing mariadb-client-core-10.0
dpkg: regarding .../mariadb-client-10.0_10.0.20+maria-1~jessie_amd64.deb containing mariadb-client-10.0:
mariadb-client-core-10.0 conflicts with mysql-client-5.5
 mariadb-client-10.0 provides mysql-client-5.5 and is to be installed.

dpkg: error processing archive /var/cache/apt/archives/mariadb-client-10.0_10.0.20+maria-1~jessie_amd64.deb (--unpack):
conflicting packages - not installing mariadb-client-10.0
(Reading database ... 45005 files and directories currently installed.)
Preparing to unpack .../mariadb-server-10.0_10.0.20+maria-1~jessie_amd64.deb ...
Unpacking mariadb-server-10.0 (10.0.20+maria-1~jessie) ...
dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.0_10.0.20+maria-1~jessie_amd64.deb (--unpack):
trying to overwrite '/usr/share/man/man1/innochecksum.1.gz', which is also in package mariadb-client-10.0 10.0.16-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Processing triggers for systemd (215-17+deb8u1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Errors were encountered while processing:
/var/cache/apt/archives/mariadb-client-core-10.0_10.0.20+maria-1~jessie_amd64.deb
/var/cache/apt/archives/mariadb-client-10.0_10.0.20+maria-1~jessie_amd64.deb
/var/cache/apt/archives/mariadb-server-10.0_10.0.20+maria-1~jessie_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

看來您已經安裝了比儲存庫中可用的更新版本的 MariaDB。你有 10.0.20,repo 有 10.0.16-1。關於 MySQL 的通知是由於mariadb-client提供了mysql-client兼容性的包。

如果你真的想從 repo 安裝一個,你需要先解除安裝現有的安裝,然後從 repo 安裝。

引用自:https://serverfault.com/questions/702852