由于 mysql 卸载不当,无法安装 mysql-server

由于 mysql 卸载不当,无法安装 mysql-server

我最近卸载了mysql它,但我认为我做的不够好。我想我可能创建了循环依赖。

运行sudo apt-get install mysql-server出现如下错误:

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
dpkg: error processing archive /tmp/apt-dpkg-install-hpScKN/0-mysql-common_5.8+1.0.4_all.deb (--unpack):

subprocess new pre-installation script returned error exit status 1
dpkg-maintscript-helper: error: dpkg: error: unknown option --validate-version

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
dpkg: error while cleaning up:
subprocess new post-removal script returned error exit status 1
Errors were encountered while processing:
/tmp/apt-dpkg-install-LZDAv0/0-mysql-common_5.8+1.0.4_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我正在尝试删除缓存中的软件包和 dpkg

sudo rm /var/cache/apt/archives/mysql*.*
sudo rm /var/lib/dpkg/info/mysql*.*
sudo dpkg --remove --force-remove-reinstreq mysql-common
sudo apt-get remove mysql-common
sudo apt-get autoremove && sudo apt-get autoclean
sudo dpkg -r mysql-client-5.7
sudo dpkg -r mysql-server-5.7
sudo dpkg -r mysql-common
sudo dpkg -r mysql
sudo dpkg --configure -a
sudo apt-get clean
sudo apt-get update

当我运行时,我的文件/var/cache/apt/archives包含以下文件.debsudo apt-get install sql-server

libaio1_0.3.110-5_amd64.deb                         mysql-common_5.8+1.0.4_all.deb
libevent-core-2.1-6_2.1.8-stable-4build1_amd64.deb  mysql-server_5.7.21-1ubuntu1_all.deb
lock                                                mysql-server-5.7_5.7.21-1ubuntu1_amd64.deb
mysql-client-5.7_5.7.21-1ubuntu1_amd64.deb          mysql-server-core-5.7_5.7.21-1ubuntu1_amd64.deb
mysql-client-core-5.7_5.7.21-1ubuntu1_amd64.deb     partial

答案1

对我来说它是这样工作的:

检查 mysql-server 是否已安装:

dpkg -l mysql-server

访问终端并输入:

sudo apt-get remove --purge mysql-server

PHPMYADMIN 删除程序 - 图形数据库管理器:

sudo apt-get remove --purge phpmyadmin 

停止 MySQL 服务:

sudo /etc/init.d/mysql stop

从 MySQL 中删除一个包:

sudo apt-get remove --purge mysql-common

使用以下命令删除位于 /var/lib/ 中的 mysql 文件夹:

sudo rm -rf /var/lib/mysql

现在:

sudo apt-get autoremove --purge
sudo apt-get autoclean
sudo apt-get clean

再次检查 MySQL 是否已安装。

dpkg -l mysql-server

现在结果以“联合国“,这意味着该包不再安装在操作系统上。

字体:https://tipslegais10.blogspot.com/2013/01/desinstalar-mysql-no-linux-por-completo.html

抱歉,我还不会说英语

相关内容