无法启动或删除 MySQL

无法启动或删除 MySQL

我在 Ubuntu 15.04 上使用 MySQL 时没有任何错误。但是昨天我从 15.04 升级到了 16.04LTS(15.04 升级到 15.10,15.10 升级到 16.04LTS)。我现在遇到了一些问题

当我使用以下方式检查 MySQL 状态时

mysqladmin -u root -p status

我收到此错误

 mysqladmin: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 2 - No such file or directory)
 mysqladmin: [ERROR] Fatal error in defaults handling. Program aborted!

所以我尝试使用

sudo apt-get remove --purge mysql-server mysql-client mysql-common

我收到这个错误

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 dbconfig-mysql : Depends: mysql-client but it is not going to be installed or
                       mariadb-client but it is not going to be installed or
                       virtual-mysql-client
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

我是 Ubuntu 新手,有人能帮我解决一下这个问题吗?提前谢谢

答案1

对我来说这看起来像是一个依赖问题,因此您可以尝试这个:

apt-get autoremove
apt-get remove --purge mysql*
apt-get autoclean
deluser mysql
rm -rf /var/log/mysql
rm -rf /var/lib/mysql
rm -rf /etc/mysql

希望这可以帮助!

相关内容