Package mysql-server-5.7 is not configured yet error when upgrading mysql? Let's fix it.
Package mysql-server-5.7 is not configured yet.
The fixes I found with google were complicated, in some cases suggested to remove the existing database or config files. None of that is necessary.
The issue is that the mysql service is not running at the point when the post installation script is trying to upgrade the database.
To fix, we'll hack the postinst script. The script is /var/lib/dpkg/info/mysql-server-5.7.postinst. Let's edit the file (as root):
sudo vi /var/lib/dpkg/info/mysql-server-5.7.postinst
Look for the line where mysql_upgrade is called:
mysql_upgrade --defaults-file=/etc/mysql/debian.cnf || result=$?
Insert a line to start the mysql service above it (both start and restart work):
service mysql restart
Save, then run the configuration step again using dpkg:
sudo dpkg --configure -a
The mysql upgrade should now run without the error: