如何在不使用apt-get和dpkg的情况下从ubuntu16.04中强制删除mysql和mariadb?

eivnm1vs  于 2021-06-23  发布在  Mysql
关注(0)|答案(2)|浏览(469)

由于错误地卸载了mariadb,我在ubuntu16.04系统中丢失了mysql和mariadb的工作示例。。。
我已经破坏了太多的依赖关系,我不能卸载或安装mysql或mariadb,使用 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.

有没有什么不同的方法从操作系统中永久删除mysql和mariadb的任何痕迹和残余,以便我可以重新安装mysql本身?
我需要使用mysql,但是我不能重新安装操作系统。
请帮帮我。

8iwquhpp

8iwquhpp1#

上帝存在!: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的帮助。

5jvtdoz2

5jvtdoz22#

最好是在serverfault.com上解决这个问题。
跑步:

dpkg --audit

找到破碎的东西。
然后运行:

dpkg --list|grep -i mysql

dpkg --list|grep -i mariadb

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

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

然后您可以尝试删除找到的与mysql/mariadb相关的包

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

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

相关问题