我安装了 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 apt-get install mysql-server-5.7 --reinstall
如果重新配置包时出现问题,您可以使用
sudo dpkg-reconfigure mysql-server-5.7
还要检查 var/log/mysql 中的错误日志,其中可能包含有关 mysql 无法正常工作的线索