This appears to be a common problem on 12.04. I\'ve tried everthing in this thread including:
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get remove
I couldnt solve this problem with purging / manual deletion / anything that mysql / ubuntu forums advised me to do
instead, the solution for me was :
1) increase the memory of the VM that Ubuntu was running on
2) after checking /var/log/mysql/error.log, I found out that a specific file couldnt be created at /tmp :
Can't create/write to file '/tmp/ibeDIRhT' (Errcode: 13) InnoDB: Error: unable to create temporary file; errno: 13
I just chmod(ed) /tmp to allow this.
Lo and behold, next attempt of installing mysql was successful.
just in case anyone ever has this problem, purging isn't always the solution, you should check the log to see what error message you have. That might help