Fixing broken myslq-server package after upgrade to 12.04

14,849

Solution 1

Reinstalling your complete system is not needed. If anything you can always do

sudo apt-get remove --purge mysql-server
sudo apt-get install mysql-server-5.5

Things that happend when I installed mysql and ran into trouble:

  • It is possible your missing or have a corrupt /etc/my.cnf (see the message about a problem in .cnf?). If so ...

    sudo mv /etc/mysql/my.cnf  /etc/mysql/my.cnf.old 
    sudo cp /etc/mysql/my.cnf.dpkg-old /etc/mysql/my.cnf
    /etc/init.d/mysql start
    

    Ofcourse do 1st check if you have a my.cnf.dpkg.dist

Solution 2

That answer is hugely dangerous to anyone that has mysql databases, as it will delete all of them. And it is not necessary to perform such a procedure. Simply do:

sudo touch /etc/apparmor.d/local/usr.sbin.mysqld
service mysqld start

And mysql will return to normal state, mysql will be running and your databases will end alive not erased..

Share:
14,849

Related videos on Youtube

umpirsky
Author by

umpirsky

Updated on September 18, 2022

Comments

  • umpirsky
    umpirsky over 1 year

    After upgrade to 12.04 mysql server was unable to start.

    I tried many different things but without any luck.

    Now when I try to install it, I get:

    $  sudo apt-get install mysql-server-5.5
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Suggested packages:
      tinyca
    The following NEW packages will be installed:
      mysql-server-5.5
    0 upgraded, 1 newly installed, 0 to remove and 39 not upgraded.
    Need to get 0 B/8,708 kB of archives.
    After this operation, 31.3 MB of additional disk space will be used.
    Preconfiguring packages ...
    Selecting previously unselected package mysql-server-5.5.
    (Reading database ... 243325 files and directories currently installed.)
    Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.22-0ubuntu1_i386.deb) ...
    Processing triggers for man-db ...
    Processing triggers for ureadahead ...
    ureadahead will be reprofiled on next reboot
    Setting up mysql-server-5.5 (5.5.22-0ubuntu1) ...
    120509 20:32:08 [Note] Plugin 'FEDERATED' is disabled.
    120509 20:32:08 InnoDB: The InnoDB memory heap is disabled
    120509 20:32:08 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    120509 20:32:08 InnoDB: Compressed tables use zlib 1.2.3.4
    120509 20:32:08 InnoDB: Initializing buffer pool, size = 128.0M
    120509 20:32:08 InnoDB: Completed initialization of buffer pool
    InnoDB: Error: log file ./ib_logfile0 is of different size 0 67108864 bytes
    InnoDB: than specified in the .cnf file 0 5242880 bytes!
    120509 20:32:09 [ERROR] Plugin 'InnoDB' init function returned error.
    120509 20:32:09 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    120509 20:32:09 [ERROR] Unknown/unsupported storage engine: InnoDB
    120509 20:32:09 [ERROR] Aborting
    
    120509 20:32:09 [Note] /usr/sbin/mysqld: Shutdown complete
    
    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
    Errors were encountered while processing:
     mysql-server-5.5
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    Can someone suggest some way to fix this or I must to reinstall entire system?

    Thanks in advance.

  • umpirsky
    umpirsky about 12 years
    Thank you very much for your quick response, really appreciate it. Here is what I got gist.github.com/548158a51643a9ddc78a :( BTW, I have no /etc/mysql/my.cnf.dpkg-dist, here is what I have gist.github.com/813c6b5164a9d50e2fb3, my.cnf.dpkg-old probably.
  • umpirsky
    umpirsky about 12 years
    I replaced my.cnf with my.cnf.dpkg-old and it did the trick, thanks a bunch!
  • Aki
    Aki about 12 years
    I don't have any file called my.cnf. What should I do?
  • umpirsky
    umpirsky about 12 years
    What do you have in /etc/mysql?
  • Rinzwind
    Rinzwind about 12 years
    @indigon could be... it could also be on a totally different location. Default it is in /etc/mysql. There should also be a default there (see the answer for the name ;) )