我安装了 MySQL,但安装过程中我的电脑崩溃了,Linux 终端死机了,因此取消了操作……现在,当我尝试安装它时,出现了这个错误
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-8.0 (8.0.25-0ubuntu0.20.04.1) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
/var/lib/dpkg/info/mysql-server-8.0.postinst: line 191: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
mysql-server-8.0
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试过做一些步骤
1st Try:
sudo apt-get clean
sudo apt-get purge mysql*
sudo apt-get update
sudo apt-get install -f
sudo apt-get install mysql-server-5.7
sudo apt-get dist-upgrade
2nd Try:
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get dist-upgrade
但无论我怎么尝试仍然无法工作,如果有人能帮助我或者给我指明正确的方向,那将是一个巨大的帮助...我已经试着解决这个问题两个小时了,真的没有主意了...
编辑:此外,我无法使用升级服务器,sudo apt-get upgrade
因为我收到同样的错误
root@hs1:~# sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up mysql-server-8.0 (8.0.25-0ubuntu0.20.04.1) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
/var/lib/dpkg/info/mysql-server-8.0.postinst: line 191: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
mysql-server-8.0
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
所以我终于把它修好了!!对于任何想要解决此问题的人,您需要执行以下操作:
sudo dpkg remove mysql-server && sudo dpkg remove mysql-server-8.0
这已经解决了我的问题,然后我重新安装了它
答案2
cd /var/lib/dpkg/info
sudo rm -rf ./mysql-*
sudo dpkg --remove --force-remove-reinstreq mysql-server-8.0
没关系!