Ubuntu – Uninstall Mysql 5.7 from Ubuntu 16.04

MySQLUbuntu

I am having problems with mysql 5.7 in ubuntu 16.04 when it comes to giving users privileges, so I want to re-install it again but when I type the command for removing mysql I get the following message

nato@nato-Compaq-Presario-CQ61-Notebook-PC:~$ 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.

I have also tried the following command but it has the same results

sudo apt-get remove --purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean

Best Answer

The answer is in the error itself.

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

The first step is to remove the dependency which disallows the removal of MySQL packages.

sudo apt-get remove dbconfig-mysql
sudo apt-get remove --purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean