(K)Ubuntu 16.04 无法安装 mysql 服务器未满足的依赖项

(K)Ubuntu 16.04 无法安装 mysql 服务器未满足的依赖项

当我尝试时,sudo apt-get install mysql-server我不断收到以下错误:

    The following packages have unmet dependencies:
 mysql-server : Depends: mysql-community-server (= 5.7.12-1ubuntu15.10) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

不知道该如何处理

当我尝试安装 mysql-community-server 时,我得到:

    The following packages have unmet dependencies:
 mysql-community-server : Depends: mysql-client (= 5.7.12-1ubuntu15.10) but it is not going to be installed
                          Depends: libmecab2v5 (>= 0.996-1.1ubuntu1)
E: Unable to correct problems, you have held broken packages.

然后在安装 mysql-client 时:

    Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  mysql-common mysql-community-client
The following packages will be REMOVED:
  mysql-client-core-5.7
The following NEW packages will be installed:
  mysql-client mysql-community-client
The following packages will be upgraded:
  mysql-common
1 upgraded, 2 newly installed, 1 to remove and 11 not upgraded.
Need to get 0 B/7705 kB of archives.
After this operation, 32,4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 177480 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.7.12-1ubuntu15.10_amd64.deb ...
Unpacking mysql-common (5.7.12-1ubuntu15.10) over (5.7.12-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/mysql-common_5.7.12-1ubuntu15.10_amd64.deb (--unpack):
 trying to overwrite '/usr/share/mysql/russian/errmsg.sys', which is also in package mysql-server-core-5.7 5.7.12-0ubuntu1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-common_5.7.12-1ubuntu15.10_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

运行后dpkg -l | grep mysql我得到:

ii  akonadi-backend-mysql                           4:15.12.3-0ubuntu6                         all          MySQL storage backend for Akonadi
ii  libmysqlclient20:amd64                          5.7.12-0ubuntu1                            amd64        MySQL database client library
ii  libqt4-sql-mysql:amd64                          4:4.8.7+dfsg-5ubuntu2                      amd64        Qt 4 MySQL database driver
ii  libqt5sql5-mysql:amd64                          5.5.1+dfsg-16ubuntu7                       amd64        Qt 5 MySQL database driver
ii  mysql-apt-config                                0.7.2-1                                    all          Auto configuration for MySQL APT Repo.
ii  mysql-client-core-5.7                           5.7.12-0ubuntu1                            amd64        MySQL database core client binaries
ii  mysql-common                                    5.7.12-0ubuntu1                            all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-server-core-5.7                           5.7.12-0ubuntu1                            amd64        MySQL database server binaries

答案1

答案在评论中,但我认为值得将其发布在那里。

我从 dev.mysql.com 下载了 mysql-apt-config_0.7.2-1_all.deb(MySQL APT 存储库 - dev.mysql.com/downloads/repo/apt),在配置过程中我选择了 Ubuntu Wily,因为 16.04 不在列表中。这就是问题所在,Xenial 在其官方存储库中已经有 MySQL 5.7。

我通过运行sudo apt-get purge mysql-apt-config然后修复了这个问题sudo apt install mysql-server

我想指出你应该感谢弗克莱姆, 不是我。

答案2

我遇到了同样的问题,但没有任何方法可以解决我的问题,对我来说最简单、最快捷的方法是使用以下命令从系统中删除 MySQL:

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean

然后再次安装:

curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb
sudo dpkg -i mysql-apt-config*
sudo apt update
sudo apt install mysql-server -y

这对我来说很有效,除了因为 Ubuntu eoan 19.10 而出现兼容性问题外,没有其他问题。我最初在这里,供大家参考。希望能够帮到你。

相关内容