APT isn't able to upgrade mySQL for me. I believe the 1045 error is due to login details. I'm able to run mysql_upgrade -uroot -p and finish it manually but how do I tell apt that it's done, please stop trying?

Setting up mysql-server-5.7 (5.7.24-0ubuntu0.16.04.1) ...
update-alternatives: warning: forcing reinstallation of alternative /etc/mysql/mysql.cnf because link group my.cnf is broken
update-alternatives: warning: not replacing /etc/mysql/my.cnf with a link
mysql_upgrade: Got error: 1045: Unknown error 1045 while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
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)
up vote 0 down vote accepted

I had to recreate the debian-sys-maint user with the password from /etc/mysql/debian.cnf

GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'PASSWORD';

If you disabled the mysql service at startup, the upgrade script fails to complete the update process. Therefore, you can enable the mysql service at startup and upgrade it like following,

sudo systemctl enable mysql.service

sudo apt update

sudo apt upgrade -y

If you want to disable mysql service at startup, you can disable it like following,

sudo systemctl disable mysql.service
  • 1
    Hi @bkayranci it would be helpful if you explained what those commands do for anyone else following along. – Mark Robinson Oct 26 at 15:26
  • @MarkRobinson I edited. Thanks. – bkayranci Oct 27 at 18:48

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.