如何在没有 `apt-get` 和 `dpkg` 的情况下从 Ubuntu 16.04 中强制删除 MySQL 和 MariaDB?

由于错误卸载 MariaDB,我在我的 Ubuntu 16.04 中丢失了 MySQL 和 MariaDB 的工作实例系统...

By wrong uninstalling MariaDB, I've lost working instance of MySQL and MariaDB in my Ubuntu 16.04 system...

我已经破坏了太多的依赖关系,以至于我无法使用 apt-get 卸载或安装 MySQL 或 MariaDB,或者dpkg...

I've broken the dependencies so much, that I can not uninstall or install MySQL or MariaDB, using apt-get, or dpkg...

以下所有命令均失败:

apt-get [install -f] [update] [remove] [purge] [autorove] [clean] [check]

以及带有 dpkg 的选项,例如:

and options with dpkg such as:

dpkg --remove --force-remove-reinstreq mysql

也别帮我.

手动下载软件包并尝试从本地文件安装没有帮助.

Manually downloading the package and attempting to install from a local file did not help.

对于每次安装、卸载或其他尝试,我得到几乎相同的结果:

For each installation, uninstallation or other attempt, I get almost the same result:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 mariadb-client : Depends: mariadb-client-10.0 (>= 10.0.34-0ubuntu0.16.04.1) but it is not installed
 mariadb-server-10.0 : PreDepends: mariadb-common (>= 10.0.34-0ubuntu0.16.04.1) but it is not installed
                       Depends: mariadb-client-10.0 (>= 10.0.34-0ubuntu0.16.04.1) but it is not installed
                       Breaks: mysql-server
 mariadb-server-core-10.0 : Depends: mariadb-common (>= 10.0.34-0ubuntu0.16.04.1) but it is not installed
 mysql-server : Depends: mysql-community-server (= 5.7.22-1ubuntu16.04) but it is not installed
E: Unmet dependencies. Try using -f.

有没有什么不同的方法可以从操作系统中永久删除 MySQL 和 MariaDB 的任何痕迹和残余,以便我可以重新安装 MySQL 本身?

Is there any different way to permanently remove any traces and remnants of MySQL and MariaDB from the operating system, so that I can reinstall MySQL itself?

我需要使用 MySQL,但我无法重新安装操作系统.

I need to working with MySQL, but I can't reinstall the operating system.

请帮帮我.

推荐答案

上帝存在!:D

问题解决了,输入:

sudo apt-get -f install

没有任何其他参数

然后通过以下方式显示所有包:

and later displaying all packages via:

sudo dpkg -l | grep mariadb
sudo dpkg -l | grep mysql

并以正确的顺序删除有问题的包:

and removing problematic packages in the right order:

sudo apt-get --purge autoremove package_name

在完全删除所有有问题的软件包后,我可以重新安装 MySQL 没有任何问题...

After the complete removal of all problematic packages, I could re-install MySQL without any problems...

感谢@YuriLachin 的帮助.

Thank you @YuriLachin for your help.

相关文章