22

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 --purge mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5

sudo apt-get install mysql-server

I still get the same old error. Installing/starting MySql5.5 looks like this:

apt-get install -f mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? Y
Setting up mysql-server-5.5 (5.5.24-0ubuntu0.12.04.1) ...
120907 21:37:15 [Note] Plugin 'FEDERATED' is disabled.
120907 21:37:15 InnoDB: The InnoDB memory heap is disabled
120907 21:37:15 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120907 21:37:15 InnoDB: Compressed tables use zlib 1.2.3.4
120907 21:37:15 InnoDB: Initializing buffer pool, size = 128.0M
120907 21:37:15 InnoDB: Completed initialization of buffer pool
120907 21:37:15 InnoDB: highest supported file format is Barracuda.
120907 21:37:15  InnoDB: Waiting for the background threads to start
120907 21:37:16 InnoDB: 1.1.8 started; log sequence number 154164236
120907 21:37:16  InnoDB: Starting shutdown...
120907 21:37:16  InnoDB: Shutdown completed; log sequence number 154164236
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--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.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

In addition, dpkg-reconfigure mysql-server-5.5 returns /usr/sbin/dpkg-reconfigure: mysql-server-5.5 is broken or not fully installed

The ultimate goal here is installing and configuring Gitorious to work with Redmine but I believe the problem is isolated to Ubuntu 12.04 and MySql5.5

Archonic
  • 5,207
  • 5
  • 39
  • 55
  • You're better off taking this question down to http://superuser.com/ StackOverflow is more akin to coding questions and not the administration surrounding environment configuration and setup. – Grambot Nov 07 '12 at 18:46
  • Thanks, it's posted here http://superuser.com/questions/502822/cant-start-mysql5-5-on-ubuntu-12-04-dpkg-dependency-problems. I suppose I should delete this one? – Archonic Nov 08 '12 at 14:38

11 Answers11

53

I found solution with this step:

WARNING: the following step will DELETE your existing data! please backup first!!!

$ sudo apt-get --yes autoremove --purge mysql-server-5.5

$ sudo apt-get --yes autoremove --purge mysql-client-5.5

$ sudo apt-get --yes autoremove --purge mysql-common

$ sudo rm -rf /var/lib/mysql /etc/mysql ~/.mysql



$ sudo deluser mysql

$ sudo apt-get autoclean

$ sudo apt-get update && sudo apt-get upgrade

$ sudo apt-get install mysql-server-5.5 mysql-client-5.5

NOTE: when you get 'dpkg: error...' please run step below:

$ sudo dpkg --configure -a

good luck!

Orion
  • 1,104
  • 3
  • 16
  • 40
Ihsan Kusasi
  • 646
  • 7
  • 3
  • 3
    this was the only solution which worked on my corrupted mysql-server and client. the things I missed were to purge the mysql client and the files in /var/lib/mysql and ~/.mysql Thank you! – syss Jan 30 '14 at 22:15
  • This worked for me for at least bring MYSQL back, I have backed up my data and Will try to restore it – Rajinder Deol Jun 08 '14 at 04:20
  • 1
    > WARNING: above step will delete your existing data! please backup first!!! Please put this warning before, rather than after, the steps!! – Orion Aug 25 '15 at 19:26
  • 1
    This worked. I have tried numerous other options but this worked. I think it's because here you are also deleting the user – Pulkit Pahwa May 09 '17 at 19:58
7

The fix from the Ubuntu forums:

This is what worked for me, though I was doing an install and not an upgrade, so I didn't care about the existing database.

I removed all the mysql application again, then I went and deleted my /var/lib/mysql directory. Keep in mind, if you have an existing database there, you will lose it. You might want to move it to another location.

After removing that directory, I installed again and it worked perfect. So something in the /var/lib/mysql directory was my problem. See if that works for you.

Community
  • 1
  • 1
Archonic
  • 5,207
  • 5
  • 39
  • 55
  • This also worked for me, but I would like to understand more about what specifically inside of /var/lib/mysql was causing the issue. @Archonic could you post a link to where you found this in the ubuntu forums? Update: I think I may have found it. http://ubuntuforums.org/showthread.php?t=2084083&p=12362816#post12362816 – kelly.dunn Apr 26 '13 at 17:01
  • That appears to be the original thread. I also posted here http://superuser.com/questions/502822/cant-start-mysql5-5-on-ubuntu-12-04-dpkg-dependency-problems – Archonic Apr 26 '13 at 17:08
  • 1
    Worked for just deleting these... /var/lib/mysql/ib_logfile1 /var/lib/mysql/ibdata1 – jimcode Aug 06 '13 at 15:58
  • This also fixed it for me. – David Skelly Dec 30 '16 at 20:18
4

Had same problem, tried to install with aptitude and discover that error

Setting up mysql-server-5.5 (5.5.41-0ubuntu0.14.04.1) ...
/var/lib/dpkg/info/mysql-server-5.5.postinst: line 146: logger: command not found
ATTENTION: An error has occured. More info is in the syslog!
/var/lib/dpkg/info/mysql-server-5.5.postinst: line 236: logger: command not found
dpkg: error processing package mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 127

after installing bsdutils,

apt-get install bsdutils

mysql installation passed normally

Opal
  • 81,889
  • 28
  • 189
  • 210
Ilya Obukhov
  • 57
  • 1
  • 2
  • Thanks for posting, I tried everything else but this is the one that fixed the problem. – mack Aug 10 '15 at 12:08
3

Make sure that

auto lo                          
iface lo inet loopback

still exists in your /etc/network/interfaces

LaurentG
  • 11,128
  • 9
  • 51
  • 66
Frank Hayward
  • 1,077
  • 7
  • 8
  • Had a very similar problem with a Debian/MySQL 5.5 installation. Tried everything above, but nothing worked. Eventually discovered the cause, which was that the server's localhost interface (lo) had been disabled. This is, the interface was still at the "/etc/network/interfaces" config file, but the interface itself was down. Re-enabling it did the trick. – luis_pmb Apr 07 '14 at 16:17
2

Just want to add my 5 cents. It may help someone else.

After hunting for and trying various solutions, without the drastic uninstall and purge, my solution was ridiculously simple.

My disk was full! I can't believe I didn't check that first. Cleared it out and hey presto!

1

I tried everything above, but it still wouldn't install. I finally got it working with this post: http://www.randomhacks.co.uk/mysql-job-failed-to-start-unable-to-set-root-password-cant-find-file-mysql/

It advises to remove folders similar to what was stated above, and also to run

dpkg --get-selections | grep mysql
sudo apt-get remove --purge [everything that came up]
sudo apt-get autoremove && sudo apt-get autoclean
sudo apt-get install mysql-server
0

I had this problem many times. I can add an other piece of solution for this jigsaw...

WARNING: the following steps will delete your data! Do a backup first!

You have to:

rm -rf /var/lib/mysql rm -rf /etc/mysql

AND

Verify that, the interface "lo" is up and, the traffic is allowed on "lo" (iptables).

Hope that help someone else !

baptx
  • 3,428
  • 6
  • 33
  • 42
MrSatan
  • 1
  • 1
0

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

Golgot Remus
  • 86
  • 1
  • 3
0

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-apt-config_0.2.1-1ubuntu14.04_all.deb

dpkg -i mysql-apt-config_0.2.1-1ubuntu14.04_all.deb

apt-get update

apt-get install mysql-server 
chopper
  • 6,649
  • 7
  • 36
  • 53
0

I wasted many hours trying to fix this and in the end it turned out that it just needed full permissions on /tmp directory (i tried 755 and 766 but didn't work, only 777 works), so i ran:

sudo chmod 1777 /tmp

"the number 1 before 777 is called the sticky bit and it adds extra security to the folder, check this for more details about the sticky bit".

and reconfigured:

sudo dpkg --configure mysql-server-5.5

and mysql server started successfully.

Community
  • 1
  • 1
razz
  • 9,770
  • 7
  • 50
  • 68
0

This error also happened when switching from MySQL to MariaDB (https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1490071).

The MySQL binary data files were not compatible with MariaDB so I switched back to MySQL because I did not have time to mess with mysqldump.

First I had to move MariaDB data away from /var/lib/mysql, then install MySQL and then move my original data from /var/lib/mysql-5.7 (this backup was automatically created before the error) to /var/lib/mysql.

baptx
  • 3,428
  • 6
  • 33
  • 42