So your Ubuntu server doesn’t want to upgrade MySQL using apt-get and fails with the following error?
mysql_upgrade: Got error: 1045: Access denied for user 'debian-sys-maint'@'localhost' (using password: YES) while connecting to the MySQL server Upgrade process encountered error and will not continue.
Thankfully the fix should be fairly easy to carry out. For some reason the password for the MySQL user debian-sys-maint has got out of sync in the MySQL database compared to that stored in /etc/mysql/debian.cnf.
Get the password that the update process thinks is in use from that file. You’ll need to do this as the root user.
grep 'password' /etc/mysql/debian.cnf
The same password should be echo’d twice. Copy and paste the password somewhere safe – like a password manager tool.
Log into MySQL as root from the command line using the normal method below. You will need to use the password for the MySQL root user here when prompted.
mysql -u root -p
Reset the password for the debian-sys-maint user, making sure you substitute in your own password from above.
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'password-here';
Now if you run the upgrade process again, it should progress and complete any MySQL server upgrades as needed.