Arr, yeah one can get stuck in odd cases like this.

Still - as the error suggests - the usual way is trying to re-install like:
  $ apt install --reinstall mysql-server-8.0

But whatever you had lying around might still/again break it from installing.
Since you can not auto-uninstall it as it isn't considered installed that can 
be hard.

For this odd - and fortunately rare - case I'd recommend manually removing all 
traces of mysql (that would break the re-install) to then re-install it from 
the packaging POV.
After that worked you should be able to upgrade/install/reinstall as you want.

  # do backups if you think you need any of this later
  $ sudo apt remove --purge mysql-server-core-8.0
  $ sudo systemctl stop mysql
  $ sudo killall -9 mysql
  $ sudo killall -9 mysqld
  $ sudo rm -rf /etc/mysql /var/lib/mysql /etc/apparmor.d/usr.sbin.mysqld 
/etc/init/mysql.* /etc/init.d/mysql /lib/systemd/system/mysql.service 
/var/log/mysql
  $ sudo deluser -f mysql
  $ sudo deluser -f mysqld
  $ sudo apt install --reinstall mysql-server-8.0

If that re-install really still fails (shouldn't be due to old config or broken 
setup then) we need to debug why it does so (must be some external reason 
then). Chances are e.g. another background service blocking the port or such.
Check `/var/log/mysql/error.log` after the failed re-install and try to resolve 
whatever it reports as the reason to fail.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1881667

Title:
  package mysql-server-8.0 8.0.20-0ubuntu0.20.04.1 failed to
  install/upgrade: package is in a very bad inconsistent state; you
  should  reinstall it before attempting configuration

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mysql-8.0/+bug/1881667/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to