Ubuntu 16.04 mysql update fails

Ubuntu 16.04 mysql update fails

We all been there when an update fails but with an LTS server version you would think this would be something the Ubuntu team would fix quickly.

Problem:

Anyway I was updating my packages today and got this error:

dpkg error processing package mysql-server-5.7 (--configure)

Now apt seems to be broken after this. (boo hoo and aarrgghh) after a quick google search I found no nice solution my only option was to reinstall, but how do I do that when I can't remove MySQL anymore.

Solution:

The good news is this can be fixed but not in a nice way so first thing is to make a backup of your database see http://www.shaunfreeman.name/a-quick-mysql-backup-and-restore/ on how to do this. When done you need to stop the current MySQL service with:

sudo systemctl stop mysql

Then you need to remove the MySQL packages with:

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.7 mysql-client-core-5.7

Once done make sure the MySQL directories

sudo rm -rf /etc/mysql /var/lib/mysql

Now run apt-get cleanup commands

sudo apt-get autoremove
sudo apt-get autoclean

Reboot your server and run apt update and reinstall MySQL with

sudo apt update
sudo apt-get install mysql-server mysql-client

Once done restore your databases. You will also need to rest all passwords on all database user accounts as this seem to clear them.

I also didn't recommend any saving of a customised 'my.cnf' as this seems to be the culprit that causing this error.

Anyway hope this helps and the Ubuntu team fix this really annoying error. If anyone has any suggestions on a better fix please let me know.

Thanks and happy coding.


26/06/2016 20:14:00 Shaun Freeman Filed Under: MySQL Linux, MySQL, Server, Ubuntu

Twitter Feed
Shaun Freeman @Zendmaster

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/Uu3RzICAjp Installing a Hyper 212 EVO on AMD AM3+

Shaun Freeman @Zendmaster

Setting Up A Test Environment For PHP In VirtualBox - Part 6 Installing Multiple PHP Versionss: https://t.co/xNXeX4XDlQ via @YouTube

Shaun Freeman @Zendmaster

I added a video to a @YouTube playlist https://t.co/xNXeX4XDlQ Setting Up A Test Environment For PHP In VirtualBox - Part 6 Installing

Shaun Freeman @Zendmaster

Banished LP #1 - Humble Beginnings: https://t.co/5riUkijyLq via @YouTube

Shaun Freeman @Zendmaster

Installing Banished on Ubuntu 18.04: https://t.co/5judq1fMSc via @YouTube