After problems with MySQL server that couldn't finish an update properly (5.7.24). I followed this answer. So basically, I can come back in a "stable" state when after running the following commands:
sudo apt update
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
sudo apt-get autoclean
sudo dpkg --configure -a
All is working, MySQL is removed and no error are returned. (I could do the apt purge without error). There are no more /etc/mysql
nor /var/lib/mysql
directories. And the last dpkg doesn't find anything to do and returns nothing.
I reboot to be sure. But now, when I am doing :
sudo apt-get install mysql-server
I am getting this error:
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Saying that is still not configured and there are dependency problems. So the install can't finish with success.
When running:
sudo dpkg-reconfigure mysql-server-5.7
It returns:
/usr/sbin/dpkg-reconfigure: mysql-server-5.7 est cassé ou partiellement installé
Can't be done because mysql-server-5.7 is broken or partially installed. So, is there a way to really return to a fresh state? I don't have to keep existing MySQL databases or configurations. Thanks.
update-alternatives
by doingsudo update-alternatives --remove my.cnf
. At least, that may get rid of the first error.mysql*
packages. First get installed packages that start withmysql
withsudo apt list --installed | grep -i -E '^mysql
. If you don't see anything that you need to keep, remove them all withsudo apt-get remove --purge mysql*
. That command will also remove configs and dependencies installed related to mysql* packages. If you see something that you need to keep, remove them one by one or with a more restricted regex. After that you can try again.