apt - MySQL服务器拒绝卸载

分享于 

4分钟阅读

ubuntu

  繁體

问题:

我输入"apt install mysql-server-8.0",然后返回:


Building dependency tree 


Reading state information... Done


Suggested packages:


 tinyca


The following packages will be upgraded:


 mysql-server-8.0


1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


1 not fully installed or removed.


Need to get 0 B/1,249 kB of archives.


After this operation, 20.5 kB of additional disk space will be used.


Preconfiguring packages ...


(Reading database ... 306894 files and directories currently installed.)


Preparing to unpack .../mysql-server-8.0_8.0.21-0ubuntu0.20.04.3_amd64.deb ...


Failed to stop mysql.service: Unit mysql.service not loaded.


invoke-rc.d: initscript mysql, action "stop" failed.


dpkg: warning: old mysql-server-8.0 package pre-removal script subprocess returned error exit status 1


dpkg: trying script from the new package instead ...


Failed to stop mysql.service: Unit mysql.service not loaded.


invoke-rc.d: initscript mysql, action "stop" failed.


dpkg: error processing archive /var/cache/apt/archives/mysql-server-8.0_8.0.21-0ubuntu0.20.04.3_amd64.deb (--unpack):


 new mysql-server-8.0 package pre-removal script subprocess returned error exit status 1


Failed to stop mysql.service: Unit mysql.service not loaded.


invoke-rc.d: initscript mysql, action "stop" failed.


Failed to start mysql.service: Unit mysql.service not found.


invoke-rc.d: initscript mysql, action "start" failed.


Unit mysql.service could not be found.


dpkg: error while cleaning up:


 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1


Errors were encountered while processing:


 /var/cache/apt/archives/mysql-server-8.0_8.0.21-0ubuntu0.20.04.3_amd64.deb


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



我尝试卸载,重新安装,mysql 5.7仍在计算机上,我尝试删除,会导致相同的错误。

我做了:dpkg --configure -a,返回:


dpkg: dependency problems prevent configuration of mysql-server-8.0:


 mysql-server-8.0 depends on mysql-server-core-8.0 (= 8.0.20-0ubuntu0.20.04.1); however:


 Version of mysql-server-core-8.0 on system is 8.0.21-0ubuntu0.20.04.3.



dpkg: error processing package mysql-server-8.0 (--configure):


 dependency problems - leaving unconfigured


Errors were encountered while processing:


 mysql-server-8.0




答案1:

  • 安装synaptic:"apt图形化前端,Ubuntu中的软件包管理系统"
  • 
    $ sudo apt-get install synaptic
    
    
    
    
  • 从选项卡中单击Mark All Upgrades
  • 该问题可能是由于某些依赖性导致的。


  • 答案2:

    $ sudo nano /var/lib/dpkg/info/mysql-server-core-8.0.prerm

    $ sudo apt remove mysql-server-core-8.0

    
    Reading package lists... Done
    
    
    Building dependency tree 
    
    
    Reading state information... Done
    
    
    The following packages will be REMOVED:
    
    
     mysql-server-8.0 mysql-server-core-8.0
    
    
    0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
    
    
    1 not fully installed or removed.
    
    
    After this operation, 124 MB disk space will be freed.
    
    
    Do you want to continue? [Y/n] 
    
    
    (Reading database ... 307573 files and directories currently installed.)
    
    
    Removing mysql-server-8.0 (8.0.21-0ubuntu0.20.04.3) ...
    
    
    Removing mysql-server-core-8.0 (8.0.21-0ubuntu0.20.04.3) ...
    
    
    Processing triggers for man-db (2.9.1-1) ...
    
    
    Processing triggers for libc-bin (2.31-0ubuntu9) ...
    
    
    
    

    已经成功了。



    相关文章