Unable to re install mysql on Ubuntu 14.04: Dependency problems [duplicate]

Ubuntu Unity 14.04 LTS with all lenses removed, except files. (Hate the dash.)

I have a LAMP system for web site development. I want to put all my data files in a particular partition that I can easily copy back and forth between my desktop and notebook machines. On the notebook (also running 14.04 LTS unity -64) I performed these steps, which worked perfectly:

sudo /etc/init.d/mysql stop
sudo cp -R -p /var/lib/mysql /ddr/mysql
gedit /etc/mysql/my.cnf  <<changed datadir from /var/lib/mysql to /ddr/mysql>>
sudo gedit /etc/apparmor.d/usr.sbin.mysqld <<changed all lines /var/lib/mysql as above>>
sudo /etc/init.d/apparmor reload
sudo /etc/init.d/mysql restart

When I attempted the very same thing on the desktop everything fell apart. I've tried reinstalling, purging, autoremoving, as mentioned here, here, and here, but the reinstall always hangs with the following message:

sadhu@desktop:~$ sudo apt-get install mysql-server mysql-common mysql-client
... <output snipped> ...
Setting up mysql-client (5.5.37-0ubuntu0.14.04.1) ...
dpkg: dependency problems prevent configuration of mysql-server:
   mysql-server depends on mysql-server-5.5; however:
   Package mysql-server-5.5 is not configured yet.
dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
 No apport report written because the error message indicates its a followup error 
 from a previous failure.

Processing triggers for libc-bin (2.19-0ubuntu6) ...
 Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
 E: Sub-process /usr/bin/dpkg returned an error code (1)
sadhu@desktop:~$

I get the same error whether or not I specify a password at install time. I update every day.

The desktop is an I3, 4GB RAM, non-UEFI; the notebook is an I5, 4GB RAM, with EFI but disabled. They are connected via back-to-back peer network. My /ddr partition (containing all my data) has over 100 GB free space. 14.04 is installed on a 20GB partition on an SSD; 7.6GB free space.

Can someone help me get mysql working again?


I have faced a very similar issue. The way I solved it is to purge the MySQL packages in APT, then install anew.

sudo apt-get purge mysql-server-5.5 mysql-common
sudo apt-get install mysql-server

Packages like mysql-common and mysql-client get installed as dependencies.

The purge seems to work in my case, as I was testing several install configurations (threaded, pre-fork, etc), and some configuration files were just stale, lingering around. The purge cleans up everything and resets the configuration.

Note that I found the list of packages to purge using dpkg -l | grep mysql, where rc and ii packages probably have to get purged (it worked for my case).