Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

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

share|improve this question

marked as duplicate by Luis Alvarado Jul 10 '13 at 7:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
no idea if it will work, but did you try dist-upgrade instead of upgrade? –  strugee May 9 '13 at 4:43
    
That saved my day! Clear steps. randomhacks.co.uk/… –  ses Apr 15 at 21:23

1 Answer 1

up vote 12 down vote accepted

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.

share|improve this answer
1  
Thanks, but will it delete the database schema during re-install ? –  Raptor May 9 '13 at 5:58
3  
No it won't. Even purging will not touch your already created database schemes. It will however overkill whatever problem you are having. –  Luis Alvarado May 9 '13 at 16:08
    
Note: purge will ask for a new mysql root password –  elomage Feb 6 at 15:32
1  
@LuisAlvarado, thanks! Had to go crazy on it. –  Jake Sellers Mar 21 at 15:47
    
in my case, after all those steps. "Unable to set password for mysql "root" user ". and then fails with: Errors were encountered while processing: mysql-server-5.5 mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1) –  ses Apr 15 at 19:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.