我在我的 Ubuntu 上安装了 MySQL 服务器和客户端以及 WordPress,现在当我想删除这些软件包时,我得到了这个:
sudo apt-get remove mysql-client-5.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
mysql-client-core-5.6 mysql-server-core-5.6
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
mysql-client-5.6 mysql-server-5.6
0 upgraded, 0 newly installed, 2 to remove and 30 not upgraded.
2 not fully installed or removed.
After this operation, 99.8 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 266816 files and directories currently installed.)
Removing mysql-server-5.6 (5.6.28-0ubuntu0.15.10.1) ...
dpkg: error processing package mysql-client-5.6 (--remove):
package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
Processing triggers for man-db (2.7.4-1) ...
Errors were encountered while processing:
mysql-client-5.6
E: Sub-process /usr/bin/dpkg returned an error code (1)
另一个也一样,现在我无法安装或删除任何东西。我该怎么办?
答案1
您必须停止 mysql 服务。“sudo service stop”
sudo service mysql stop #or mysqld
sudo killall -9 mysql
sudo killall -9 mysqld
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo deluser mysql
sudo rm -rf /var/lib/mysql
sudo apt-get purge mysql-server-core-5.5
sudo apt-get purge mysql-client-core-5.5
sudo rm -rf /var/log/mysql
sudo rm -rf /etc/mysql
apt-get autoclean
apt-get update
apt-get upgrade
apt-get install -f
你安装的是全新的 mysql
或者
sudo apt-get remove --purge mysql-server mysql-client mysql-common
apt-get autoclean
apt-get update
apt-get upgrade
apt-get install -f