Issue
I tried to install / remove and reinstall / fix Mysql and Workbench in Ubuntu 20.04 but allways get this message:
Building dependency tree
Reading state information... Done
mysql-server is already the newest version (8.0.20-2ubuntu20.04).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libmysqlclient21 : Depends: mysql-common (>= 8.0.20-2ubuntu20.04) but 5.8+1.0.5ubuntu2 is to be installed
mysql-client : Depends: mysql-community-client (= 8.0.20-2ubuntu20.04) but it is not installable
mysql-community-test : Depends: mysql-community-server (= 8.0.20-2ubuntu20.04) but it is not installable
Depends: mysql-community-client (= 8.0.20-2ubuntu20.04) but it is not installable
Depends: libjson-perl but it is not going to be installed
Depends: mysql-community-server-core but it is not installable
mysql-server : Depends: mysql-community-server (= 8.0.20-2ubuntu20.04) but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
When I try sudo apt --fix-broken install this comes out:
The following packages have unmet dependencies:
libmysqlclient21 : Depends: mysql-common (>= 8.0.20-2ubuntu20.04) but 5.8+1.0.5ubuntu2 is installed
mysql-client : Depends: mysql-community-client (= 8.0.20-2ubuntu20.04) but it is not installable
mysql-community-test : Depends: mysql-community-server (= 8.0.20-2ubuntu20.04) but it is not installable
Depends: mysql-community-client (= 8.0.20-2ubuntu20.04) but it is not installable
Depends: libjson-perl but it is not installed
Depends: mysql-community-server-core but it is not installable
mysql-server : Depends: mysql-community-server (= 8.0.20-2ubuntu20.04) but it is not installable
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies
I'm sorry, I'm sure there is a easy solution.. but I can't find it.
Solution
Try applying
sudo apt autoremove libmysqlclient21 mysql-client mysql-community-test mysql-server
If any other new unmet dependency shows up append the package at the end of the above command.
This shows up because when there are several packages dependent upon each other, removing only one will break the dependency count.
So removing them simultaneously ensures no broken packages.
Revert if you find any other issue
Answered By - Nagaraj V