Can't get MYSQL8 to work on Ubuntu 20.04

Try

sudo apt-get install --reinstall mysql-server-8.0

and check if mysql.service exists

ls -laF /lib/systemd/system/mysql.service

To fix broken packages

sudo apt-get install -f
sudo dpkg --configure -a

Fix mysql.service that may have been left over from an old installation

sudo killall mysqld
sudo systemctl disable mysql.service
sudo rm -rf /lib/systemd/system/mysql.service
sudo rm -rf /usr/lib/systemd/system/mysql.service
sudo rm -rf /etc/systemd/system/multi-user.target.wants/mysql.service
sudo rm -rf /var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/mysql.service
sudo rm -rf /var/cache/apt/archives/mysql-server-*.deb

sudo apt-get install -f
sudo dpkg --configure -a

sudo apt-get install --reinstall mysql-server-8.0


Regarding this specific error:

Unit mysql.service could not be found.

[I'm running Ubuntu 20.04]

I spent a few hours on it before I discovered this: Months ago I played with MariaDB and had uninstalled it, but apparently it didn't get completely/cleanly uninstalled. It left two symlinks in

ls /etc/systemd/system
mysql.service -> /lib/systemd/system/mariadb.service
mysqld.service -> /lib/systemd/system/mariadb.service

The linked files had been removed by not the links themselves. I ran "unlink" on both the links, uninstalled all mysql packages with dpkg -P and reinstalled and it came up fine.

[I'm running Ubuntu 20.04] Good Luck.