MySQL 5.7 'Already Upgraded' and dpkg Interrupted Error

Fix 'This installation of MySQL is already upgraded to 5.7.29' and the interrupted dpkg error on Ubuntu by editing the postinst script.

MySQL 5.7 'Already Upgraded' and dpkg Interrupted Error

This installation of MySQL is already upgraded to 5.7.29, use --force if you still need to run mysql_upgrade E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.

The solution is:

1- Open this file for edit:
/var/lib/dpkg/info/mysql-server-5.7.postinst

2- At line # 370, comment the echo ALTER statement which would like  
#echo "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'auth_socket';" >> "$initfile"
(just add # to the beginning of this line to convert it to comment)

3- Save above file and start updating it will be fine

📝 A note from my own work, first published in 2020.

Akam Omer
Written by

Akam Omer

IT leader, engineer and security specialist from Erbil with 20+ years across higher education, telecoms, healthcare and government. Founder of BulkSMSIraq, VerifyWay and Kurd.ai.