回复:安装错误

回复:安装错误

为什么我得到

E: Sub-process /usr/bin/dpkg returned an error code (1) 

当我打字时apt-get install -f我该如何解决?

root@john-PC:~# apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  mysql-server-5.6
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-server-5.6
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
1 not fully installed or removed.
Need to get 0 B/5,766 kB of archives.
After this operation, 51.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 230930 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.6_5.6.28-0ubuntu0.15.04.1_i386.deb ...
Aborting downgrade from (at least) 10.0 to 5.6.
If are sure you want to downgrade to 5.6, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.6_5.6.28-0ubuntu0.15.04.1_i386.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.6_5.6.28-0ubuntu0.15.04.1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

这是因为 mysql 已经安装。
解决方法如下,按照顺序操作,其中一个可以修复错误:
1. apt-get autoremove
2. dpkg --configure -a
或者
1. 尝试清除 mysql-server。2
. 清理缓存:

sudo rm /var/cache/apt/archives/mysql-server*    
sudo apt-get update && apt-get install >package< 

相关内容