15

I failed to upgrade MySQL server. Here's what I tried:

I first issue this command to update the package list:

sudo apt-get update

Then, upgrade by:

sudo apt-get upgrade

It shows the following error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 mysql-server-5.5 : Depends: mysql-server-core-5.5 (= 5.5.28-0ubuntu0.12.04.2) but 5.5.31-0ubuntu0.12.04.1 is installed
E: Unmet dependencies. Try using -f.

Apparently a newer version is installed (but why? I didn't install manually). Okay, As it suggests, I issue the command to attempt fixing:

sudo apt-get -f install

Here is the output:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  mysql-server mysql-server-5.5
Suggested packages:
  tinyca mailx
The following packages will be upgraded:
  mysql-server mysql-server-5.5
2 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
2 not fully installed or removed.
Need to get 0 B/8889 kB of archives.
After this operation, 64.5 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_HK.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
dpkg: dependency problems prevent configuration of mysql-server-5.5:
 mysql-server-5.5 depends on mysql-server-core-5.5 (= 5.5.28-0ubuntu0.12.04.2); however:
  Version of mysql-server-core-5.5 on system is 5.5.31-0ubuntu0.12.04.1.
dpkg: error processing mysql-server-5.5 (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          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 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.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Then I try to use another command that some people suggest in the Internet:

sudo apt-get -f upgrade

Same output is produced. Apart from re-installing MySQL server, what else can I do ?

using Ubuntu server 12.04 LTS

3

1 Answer 1

28

That happened to me but it was that, after doing a sudo apt-get update it somehow did not get the newest version of the mysql-server, only of the mysql-server-core. I would first suggest to do another sudo apt-get update and then proceed on installing the package

sudo apt-get install mysql-server

If that does not work then do a reinstall:

sudo apt-get install --reinstall mysql-server

And if that does not work, then simply purge the package mysql-server-core package, then install mysql-server again.

sudo apt-get purge mysql-server-core mysql-server-core-5.5

sudo apt-get install mysql-server

And if that does not work then go crazy on it with:

sudo apt-get clean

sudo apt-get autoclean

sudo apt-get purge mysql-server*

sudo apt-get install mysql-server

As a last resort, I would purge, reboot, install.

10
  • 2
    Thanks, but will it delete the database schema during re-install ?
    – Raptor
    May 9, 2013 at 5:58
  • 4
    No it won't. Even purging will not touch your already created database schemes. It will however overkill whatever problem you are having. May 9, 2013 at 16:08
  • 1
    That helped me. randomhacks.co.uk/…
    – ses
    Apr 15, 2014 at 21:56
  • 1
    You are on some next level Luis, thanks for this (had to go crazy too)
    – a7omiton
    Nov 1, 2014 at 18:59
  • 1
    Similar problem after an upgrade of Ubuntu 18.04 to 20.04. Had to do the go crazy method but the difference on my system was that mysql-server-5.7* was still lingering. So my go crazy was more radical and involved apt-get purge mysql Jan 14, 2021 at 0:42

Not the answer you're looking for? Browse other questions tagged .