Question: I want to uninstall mysql completely from ubuntu 20.04.
`sudo apt-get remove --purge mysql-server mysql-client mysql-common -y`

But every time got errors.

dpkg: error processing package mysql-server-8.0 (--remove):
package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
dpkg: too many errors, stopping
Errors were encountered while processing:
mysql-server-8.0
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried configuring dpkg `sudo dpkg --configure -a` , but again it says :

dpkg: error processing package mysql-server-8.0 (--configure):
package is in a very bad inconsistent state; you should
reinstall it before attempting configuration
Errors were encountered while processing:
mysql-server-8.0

Answer: 
I had the same challenge in `xubuntu 20.04`. This is what worked for me after several attempts.
I hope it helps someone in future.

1. list all files associated with mysql-server

```
sudo ls -l /var/lib/dpkg/info | grep -i mysql-server 

```

2. Remove the different file groups.

```
sudo rm -r /var/lib/dpkg/info/mysql-server-8.0.*
sudo rm -r /var/lib/dpkg/info/mysql-server-core-8.0.* 

```

3. Run

```
sudo apt update

```

Try reinstalling whatsoever you will trying to install.
Regarding your current issue. In order to completely get rid of your MySQL installation you could run the following:

Make sure MySQL is not running:

```
sudo systemctl stop mysql

```

Then purge all of the MySQL packages:

```
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*

```

Then delete all of the MySQL files:

```
sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql

```

Finally clean all packages that are not needed:

```
sudo apt autoremove
sudo apt autoclean

```