当我运行sudo apt-get update && sudo apt-get upgrade
我的包时,系统因为 mysql 包而损坏。
我尝试卸载客户端和所有其他软件包,然后再次安装,但问题在下一次更新时出现。
到目前为止我发现的唯一可行的解决方案如下:
mabe@ubuntu:~ $ sudo apt-get -f install
[sudo] password for mabe:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
mysql-client-5.6
The following packages will be upgraded:
mysql-client-5.6
1 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
10 not fully installed or removed.
Need to get 0 B/5,564 kB of archives.
After this operation, 151 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 452900 files and directories currently installed.)
Preparing to unpack .../mysql-client-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-5.6 (5.6.30-0ubuntu0.14.04.1) over (5.6.28-0ubuntu0.14.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/mysql-client-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mysql_config_editor', which is also in package libmysqlclient-dev 5.7.12-1ubuntu14.04
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/mysql-client-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
mabe@ubuntu:~ $ sudo dpkg -i --force-overwrite /var/cache/apt/archives/mysql-client-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb
(Reading database ... 452900 files and directories currently installed.)
Preparing to unpack .../mysql-client-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-5.6 (5.6.30-0ubuntu0.14.04.1) over (5.6.28-0ubuntu0.14.04.1) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/bin/mysql_config_editor', which is also in package libmysqlclient-dev 5.7.12-1ubuntu14.04
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/share/man/man1/mysql_config_editor.1.gz', which is also in package libmysqlclient-dev 5.7.12-1ubuntu14.04
dpkg: dependency problems prevent configuration of mysql-client-5.6:
mysql-client-5.6 depends on mysql-client-core-5.6; however:
Package mysql-client-core-5.6 is not configured yet.
dpkg: error processing package mysql-client-5.6 (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Errors were encountered while processing:
mysql-client-5.6
mabe@ubuntu:~ $ sudo apt-get -f
installReading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
11 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up tzdata (2016d-0ubuntu0.14.04) ...
Current default time zone: 'Europe/Rome'
Local time is now: Tue Apr 26 09:43:03 CEST 2016.
Universal Time is now: Tue Apr 26 07:43:03 UTC 2016.
Run 'dpkg-reconfigure tzdata' if you wish to change it.
Setting up libapt-inst1.5:amd64 (1.0.1ubuntu2.13) ...
Setting up google-chrome-stable (50.0.2661.86-1) ...
Setting up libpcrecpp0:amd64 (1:8.31-2ubuntu2.3) ...
Setting up libsnmp-base (5.7.2~dfsg-8.1ubuntu3.2) ...
Setting up libsnmp30:amd64 (5.7.2~dfsg-8.1ubuntu3.2) ...
Setting up mysql-client-core-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Setting up mysql-client-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Setting up mysql-server-core-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Setting up mysql-server-5.6 (5.6.30-0ubuntu0.14.04.1) ...
mysql start/running, process 11619
Setting up tzdata-java (2016d-0ubuntu0.14.04) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
有没有比sudo dpkg -i --force-overwrite /var/cache/apt/archives/mysql-client-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb
每次更新后更好的、永久的解决方案?
预先感谢您的帮助
输出apt-cache policy mysql-common libmysqlclient-dev
mabe@ubuntu:~/Development/lumen-etl (development)$ apt-cache policy mysql-common libmysqlclient-dev
mysql-common:
Installed: 5.7.12-1ubuntu14.04
Candidate: 5.7.12-1ubuntu14.04
Version table:
*** 5.7.12-1ubuntu14.04 0
500 http://repo.mysql.com/apt//ubuntu/ trusty/mysql-5.7 amd64 Packages
100 /var/lib/dpkg/status
5.5.49-0ubuntu0.14.04.1 0
500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
5.5.35+dfsg-1ubuntu1 0
500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
libmysqlclient-dev:
Installed: 5.7.12-1ubuntu14.04
Candidate: 5.7.12-1ubuntu14.04
Version table:
*** 5.7.12-1ubuntu14.04 0
500 http://repo.mysql.com/apt//ubuntu/ trusty/mysql-5.7 amd64 Packages
100 /var/lib/dpkg/status
5.5.49-0ubuntu0.14.04.1 0
500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
5.5.35+dfsg-1ubuntu1 0
500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
答案1
你有两个提供 MySQL 的存储库:官方的 Ubuntu 14.04 存储库提供 MySQL 5.5,官方 MySQL提供 5.7。这就是为什么您不能手动安装 5.6 软件包,除非强制安装,最好使用 5.5 或 5.7。在这种情况下,您应该:
卸载所有残留的 5.6 软件包,您可以使用 找到它们
dpkg -l | grep mysql
。如果你想使用 5.5,从您的中删除 MySQL 存储库
sources.list
,并卸载所有 5.7 软件包。最后,安装
mysql-client-5.5
或mysql-client-5.7
,具体取决于您需要哪一个。