Thursday, March 26, 2009

Mysql 5.1 downgrade to Mysql 5.0 on Ubuntu Intrepid Ibex

Hi couldn't understand why apt-get would always give the following error when trying to downgrade mysql on ubuntu:

Unpacking mysql-server-5.0 (from .../mysql-server-5.0_5.0.51a-3ubuntu5.4_amd64.deb) ...
Aborting downgrade from (at least) 5.1 to 5.0.
dpkg: error processing /var/cache/apt/archives/mysql-server-5.0_5.0.51a-3ubuntu5.4_amd64.deb (--unpack):
 subprocess pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.0_5.0.51a-3ubuntu5.4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Finally figured it out. For downgrading, you must delete /var/lib/mysql directory.

After deleting that directory, I ran the following command, and had mysql setup and ready to go:

sudo apt-get -f install

14 comments:

  1. thanks a lot!!!
    i couldn't downgrade from mysql 5.1 to 5.0 , and i've search in a lot of forums and i didn't found anything usefull.
    The answer is delete de directory as you said.

    mbarria

    ReplyDelete
  2. You're very welcome Marcelo - glad this was of help :-)

    ReplyDelete
  3. Thank you, helped me as well - couldn't find this answer on the first 15 sites I looked :)

    ReplyDelete
  4. Well, just don't ask where your databases went and why to hell.

    I found it simpler to (re)move debian-5.1.flag and mysql_upgrade_info from that directory.
    Of course that flags aren't for nothing, so be warned that your mileage may vary.

    ReplyDelete
  5. You're welcome Gustavo. I'm glad this was of help!

    ReplyDelete
  6. Thanks alot, though you DO NOT need to delete the whole directory, it is sufficient to remove the flag file located inside the directory, at least for me that worked.

    ReplyDelete
  7. Lol - you're very welcome, Sebastian. I'm glad this was of help!

    ReplyDelete
  8. @Dźwiedziu
    Thank goodness I saw your post I almost killed all my data... Your suggestion worked perfectly!!!
    Just delete those 2 files

    ReplyDelete
  9. Thank you very much for this, even a year later..I fubar'd my Nagios install, at least some dependency on apache2....im stupid but you saved me! Thanks again.

    ReplyDelete
  10. very very very much thanks!!! i have sex with this error 2 hour >:-(

    ReplyDelete