mysql 无法卸载

mysql 无法卸载

我想在 Ubuntu 16.04 中重新安装 mysql。

mysql-server is already the newest version (5.7.21-0ubuntu0.16.04.1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

在此之后,我编写了一个删除 mysql 的代码,但它并没有被删除。

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'mysql-server-core-5.1' for glob 'mysql-server-core-*'
Note, selecting 'mysql-server-core-5.5' for glob 'mysql-server-core-*'
Note, selecting 'mysql-server-core-5.6' for glob 'mysql-server-core-*'
Note, selecting 'mysql-server-core-5.7' for glob 'mysql-server-core-*'
Package 'mysql-server-core-5.6' is not installed, so not removed
Package 'mysql-server-core-5.5' is not installed, so not removed
Package 'mysql-server-core-5.1' is not installed, so not removed
Note, selecting 'mysql-client-core-5.5' for glob 'mysql-client-core-*'
Note, selecting 'mysql-client-core-5.6' for glob 'mysql-client-core-*'
Note, selecting 'mysql-client-core-5.7' for glob 'mysql-client-core-*'
Package 'mysql-client-core-5.5' is not installed, so not removed
Package 'mysql-client-core-5.6' is not installed, so not removed
Package 'mysql-client' is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libmysqlclient20 : Depends: mysql-common (>= 5.5) but it is not going to be installed
 mariadb-common : Depends: mysql-common (>= 5.6.25) but it is not going to be installed
 mysql-client-5.7 : Depends: mysql-client-core-5.7 but it is not going to be installed
                    Depends: mysql-common (>= 5.5) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

答案1

您可以尝试以下步骤:

  1. mysql-server将从您的系统中删除。

    apt-get autoremove mysql-server
    
  2. 检查您是否还mysql安装了。

    mysql -V
    
  3. 这将安装 mysql-server

    apt-get install mysql-server
    

如果你仍然有问题,请先

apt-get install -f

如果仍然不起作用请尝试:

dpkg-reconfigure mysql-server

相关内容