Mysql – What happens to existing MySQL databases when I upgrade the Ubuntu distro

MySQLUbuntuupgrade

I am in the midst of upgrading my Ubuntu distro from 10.4 to 12.4. Fearfully, it asked me for root password on MySQL when I was upgrading the distro.

I used to have databases on that server, would they be erased? If so, how could I get them back?

Best Answer

Your databases will remain untouched (though of course I can't be liable :) ).

The reason are are being asked for a password could be:

  • Your new Ubuntu version uses a newer version of MySQL (it does). It needs root password so as to run the mysql_upgrade utility, which upgrades internal mysql schema to fit new version

  • You new installation includes new packages/dependencies, for which a new schema should be created. Such packages could be phpmyadmin, cacti, bugzilla, wordpress or any others which may require use of a database schema.

You should be in particular comfortable with this upgrade since this is from one LTS (Long Term Support) version to another. Not that I would expect database problems with other upgrades, but still, LTS versions are expected to be more "trusted".

Just to conclude, I am using Ubuntu. Usually installing MySQL from external binaries, but sometimes from package. I've never heard of a "data gone lost" problem due to an upgrade.