Bug #45200 Windows .msi installer does not detect existing root pw on first configuration.
Submitted: 30 May 2009 0:44 Modified: 13 Oct 2009 11:45
Reporter: Patrick Crews
Status: Closed
Category:Server: Config Wizard Severity:S3 (Non-critical)
Version:5.0+ OS:Microsoft Windows (XP)
Assigned to: Iggy Galarza Target Version:5.0+
Tags: root password, configuration, .msi, windows
Triage: Triaged: D3 (Medium)

[30 May 2009 0:44] Patrick Crews
Description:
The Windows .msi installer is not detecting existing root passwords if the server has
been removed.

If you install a version of the server, remove it, re-install it, then try to configure
the new installation, the wizard will not detect the previous root password in the
datadir and will not present the user with a prompt for the current pw.  

This results in a failure of the configuration on the 'Change Security Settings' portion
of the configuration.

However, if you either run through the configure without trying to change the security
settings, or try to change them, fail, then re-configure the server, you will be prompted
for the current root pw before entering a new one.

Detected on Windows XP 32 bit.

How to repeat:
1) Install a version of the server (tested with 5.0.82, 5.1.35, and 5.1.31) via the .msi
2) Configure the server and set a root password
3) Remove the server (do *not* remove the data directory)
4) Re-install the server using the same settings.
5) Re-configure the server and note that you will not be prompted for the existing
password when you get to the security section of the configuration.
6) Enter a new root password and complete the configuration
7) Note that it fails during the security portion of the configure.

If you either skip the change in security or fail as in step 7 then reconfigure the
server, you *will* be prompted for an existing pw on this configuration.

Suggested fix:
Ensure that the .msi detects existing root passwords and prompts the user appropriately.
[18 Jun 2009 0:42] Iggy Galarza
Duplicate of http://bugs.mysql.com/bug.php?id=44428.
[6 Jul 2009 20:40] Patrick Crews
Was marked as a duplicate of Bug#44428, but this isn't the case.
44428 deals with the removal / reinstatement of an instance via the configuration wizard.
 This bug deals with re-installation of the server itself after a removal via the .msi
(not just the config wizard).

To repeat this bug:
1)  Install the server via the .msi and configure it.  I chose Complete installation and
the default configuration options with a simple password

2)  Remove the MySQL installation via the .msi - click on the .msi used in step 1 and
choose the 'Remove' option.  *Do NOT* touch the left over data directory

3)  Re-install the server after the removal - click on the same .msi and follow the
complete /same  installation and configuration steps.

When you get to the security settings, note that you are not prompted for the existing
root pw.  The leftover datadir + the simple pw set in step 1 require a password, but you
will not be prompted.

Try to set a new root pw and finish the configuration.  Note that you will fail and
receive an error message.  If you Cancel the configuration at this point, then
re-configure this instance, you *will* be prompted for the root pw (set in step 1).

One thing I noted was that the .msi-based Remove results in the registry key
FoundExistingDataDir being set to 1.  However, this value is reset to 0 during the
re-install process (as soon as the install process moves from "Copying new files" to the
launch of the MySQL Enterprise ads).

I will be attaching .msi-generated log files for the initial installation and the
re-install.
[6 Jul 2009 20:43] Patrick Crews
initial install + reinstall logs

Attachment: msi_logs.tar.gz (application/x-gzip, text), 100.80 KiB.

[17 Jul 2009 2:46] Patrick Crews
Tested same msi on XP 32 bit and Vista 64 bit.
This bug only shows up on XP 32 bit.  Vista 64 bit performed exactly as expected -
removal and re-install of the server via the .msi will result in the user being prompted
for the existing root password during the re-install / re-configure.
[3 Aug 2009 22:03] Patrick Crews
Tested fine on Windows 2003 64 bit with the test (patched) .msi
[13 Oct 2009 11:45] MC Brown
A note has been added to the 5.0.87, 5.1.40 and 5.4.3 changelogs: 

 When re-installing MySQL on Windows on a server that has a data directory from a
previous MySQL installation, the installer would fail to identify the existence of the
installation and the password configured for the <literal>root</literal> user.