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

How to forcefully remove MySQL and MariaDB from Ubuntu 16.04, without `apt-get` and `dpkg`?

由于错误卸载 MariaDB,我丢失了 MySQLMariaDB 在我的 Ubuntu 16.04 系统中...

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

以下所有命令均失败:

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

和带 dpkg 的选项,例如:

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

也不帮我

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

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

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.

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

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

请帮帮我

上帝存在! :D

问题已通过输入解决:

sudo apt-get -f install

没有任何其他参数

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

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

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

sudo apt-get --purge autoremove package_name

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

感谢@YuriLachin 的帮助。

最好向 serverfault.com 提出问题。

运行:

dpkg --audit

找出损坏的地方。

然后运行:

dpkg --list|grep -i mysql

dpkg --list|grep -i mariadb

查看第一(状态)列,并可选择检查某些包的详细状态:

dpkg-info -s <name-of-package>

然后你可以尝试移除找到的 mysql/mariadb 相关包

dpkg -remove --force-remove-reinstreq <package-list>

作为一种解决方法,您始终可以在 docker 容器中 运行 mysq 而无需安装 mysql