我一直试图从我的节点中删除 MySQL,但删除失败。我尝试过 remove、purge、dpkg --force-all,但都不起作用。有什么建议吗?
dpkg --purge --force-all mysql-server-8.0
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
(Reading database ... 281877 files and directories currently installed.)
Removing mysql-server-8.0 (8.0.22-0ubuntu0.20.04.3) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing package mysql-server-8.0 (--purge):
installed 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:
mysql-server-8.0
dpkg --install /var/cache/apt/archives/mysql-server-8.0_8.0.23-0ubuntu0.20.04.1_amd64.deb
Selecting previously unselected package mysql-server-8.0.
(Reading database ... 281878 files and directories currently installed.)
Preparing to unpack .../mysql-server-8.0_8.0.23-0ubuntu0.20.04.1_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.23-0ubuntu0.20.04.1_amd64.deb (--install):
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.23-0ubuntu0.20.04.1_amd64.deb
apt install --reinstall mysql-server-8.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
mailx tinyca
The following packages will be upgraded:
mysql-server-8.0
1 upgraded, 0 newly installed, 0 to remove and 53 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,275 kB of archives.
After this operation, 14.3 kB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 281878 files and directories currently installed.)
Preparing to unpack .../mysql-server-8.0_8.0.23-0ubuntu0.20.04.1_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.23-0ubuntu0.20.04.1_amd64.deb (--un
pack):
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.23-0ubuntu0.20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
失败的命令列表:
All of the following failed, same error as above:
dpkg --purge --force-all mysql-server-8.0
dpkg --install mysql-server-8.0
dpkg --install /var/cache/apt/archives/mysql-server-8.0_8.0.23-0ubuntu0.20.04.1_amd64.deb
dpkg --remove --force-all mysql-server-8.0
dpkg --configure -a
dpkg --purge --force-all mysql-server-8.0
apt install --reinstall mysql-server-8.0
答案1
首先尝试运行这个:
sudo systemctl disable mysql