Ubuntu – MySQL breaks after upgrade from Ubuntu 14.04LTS to Ubuntu 15.04

15.04dpkgMySQLserverupgrade

I recently upgraded from Ubuntu 14.04LTS to 15.04 and during this upgrade, MySQL probably broke. After the upgrade, I ran the command(to start mysql):

sudo service mysql start

The result was command not found and it suggested I install mysql-server and mysql-common packages which means they were purged during the upgrade. I decided to install the packages again with:

sudo apt-get install mysql-server

Here is where I encountered problems and errors. This is what appears(part of it) on my terminal when I run the above command:

Setting up mysql-server-5.6 (5.6.24-0ubuntu2) ...
Job for mysql.service failed. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.6; however: 
  Package mysql-server-5.6 is not configured yet.
  Package mysql-community-server which provides mysql-server-5.6 is not installed.

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.
Errors were encountered while processing:
 mysql-server-5.6
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have checked almost "similar" problems to this here, here and here but none seem to be helping and this are from older upgrades. Also, I decided to try and install the server,client & workbench from Ubuntu Software Center. There was an error during the installation but it appeared to have installed anyway because from the workbench it showed the server was running. I also happen to have the LAMPP stack in the ./opt folder and there might be a conflict here. The other problem is, I do not have control over the server from the terminal or even the workbench. If I try and access MySQL from the terminal with:

mycomp:~$ mysql -u user -p

I get the result:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2)

Since Ubuntu 15.04 was released almost a few days ago, solution elsewhere is not easily available. If this post was supposed to be in a MySQL forum then I apologize for this mistake but I would appreciate for any answers given.

Best Answer

Check the logs while starting mysql:

  • In one terminal: tail -f /var/log/mysql/error.log
  • In another one: sudo service mysql start (maybe you first need to stop the service with sudo service mysql stop).
  • If there are errors, you need to fix them.

In my case I had following errors:

[ERROR] mysqld: unknown variable 'table_cache=256'
[ERROR] Aborting

Due to the mysql issue: table_cache renamed table_open_cache the server didn't start.

Renaming this variable in my settings (/etc/mysql/conf.d/my_custom.cnf) fixed my problem and mysql started as used.

Finally I updated mysql by calling sudo mysql_upgrade -u root -p

Related Question