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.


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.


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

Twitter Feed
Shaun Freeman @Zendmaster

Shaun Freeman @Zendmaster

Fixing PHP OPcache mysql_xdevapi Uncaught Error: Call to a member function limit() https://t.co/3xSyOxmlj1

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/iI9BZaslSm 8 super heroic Linux commands that you probably aren't using

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/SOOJGb32h0 How to Maximize Your Productivity (As a Software Developer or Learning Programming)

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/8nGfvmdsI2 From Carnivore Diet to Near-Death: Lessons Learned From Today's Most Popular Fad Diet

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/EFLh2y3I24 Carnivore Diet – Myths about Meat – Phil Escott – WHIS 2018