Bug #61826 Upgrading to 5.5x from an instance originally installed as 5.0 loses all data
Submitted: 11 Jul 2011 20:18 Modified: 11 Apr 2018 15:51
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Installing Severity:S1 (Critical)
Version:5.5.x OS:Windows
Assigned to: CPU Architecture:Any
Tags: qc

[11 Jul 2011 20:18] Peter Laursen
Description:
Upgrading to 5.5x from an instance originally installed as 5.0 loses all data.

How to repeat:
1) Install 5.0.x on Windows using the installer and default settings. /datadir will be a subfolder to installation folder

2) Upgrade the 5.0 instance to 5.1 also using the installer (and run mysql_upgrade and everything else that is needed. Skip the config wizard to avoid complications).

3) Upgrade to 5.5. 

BOOM! all data are lost and not even a warning appears. The reason is this: http://bugs.mysql.com/bug.php?id=56926

And probaly the reason for this problem as well: http://bugs.mysql.com/bug.php?id=61093

Suggested fix:
Don't overwrite an existing datadir with an empty one.
[11 Jul 2011 20:20] Peter Laursen
One more reference: http://bugs.mysql.com/bug.php?id=61814

(the user here decided to close so I have no option to continue there).
[12 Jul 2011 9:51] Peter Laursen
I could suggest as a minimum that before the 'clean'/empty data folder is created any existing 'data' folder will be renamed by the installer.  The config wizard actually does this with my.ini when it creates a new configuration - and data should be considered even more important than configuration IMHO. And the installer interface should inform user when such happens.
[13 Jul 2011 15:46] Vladislav Vaintroub
@Peter,
did you actually run your described scenario, or just expect a problem there could be a problem? By default, installation paths would include versions, i.e data directory would be "MySQL Server x.y\data", in Program Files, or in ProgramData. Thus a path clash is not possible with all defaults.
[13 Jul 2011 15:52] Peter Laursen
@Vlad I know.

But it is is a valid scenario to upgrade a 5.0 instance to 5.1 and 5.5 - also if the file path has the substring "MySQL Server 5.0". Also not all users use the default path.  Consider if somebody installed 5.0 to D:\MySQL and was since upgraded to 5.1 and 5.5.

We have reports here about people losing data when upgrading to 5.5. I have seen a few more in other forums.
[15 Jul 2011 8:12] Valeriy Kravchuk
I agree that installer should NOT simply overwrite existing data if datadir is set as data subdirectory of installation directory. This is a bug.
[15 Jul 2011 8:15] Valeriy Kravchuk
Bug #61093 was marked as a duplicate of this one.
[11 Apr 2018 15:51] Erlend Dahl
[22 Jan 2018 8:01] Piotr Obrzut

This problem got resolved through documentation changes:
https://dev.mysql.com/doc/refman/5.5/en/windows-install-wizard.html. Contrary
to the description it only affects server 5.5. There is no safe programmatic
solution for server 5.5 unfortunately.