Bug #45050 uninstaller fails to completely remove service
Submitted: 23 May 2009 18:47 Modified: 26 Jan 2017 6:34
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:5.1.34 - 64 bit OS:Windows (Win7 RC 64 bit)
Assigned to: CPU Architecture:Any
Tags: qc

[23 May 2009 18:47] Peter Laursen
Description:
In another report (http://bugs.mysql.com/bug.php?id=44992) I mentioned a porblem with the uninstaller.  As this is quite another issue that what the other report was about I will create a new report for the uninstaller issue.

The problem is that the uninstaller shipped with the server fails to uninstall the service completely. The MySQL server gets removed from the add/remove software menu in COntrol Panle, but not from "Computer Management .. Services" menu. Additionally

* Even after a reboot "Computer Management .. Services" displays the service. 
* Trying to reinstall using same service name fails for that reason
* Trying to connect from a client fails with error 2003 "Can't connect" (obviosuly as there is no binary .. only the my.ini and my.ini backups left in installation folder)

You will need to use the Regedit program and manually remove all instances of the service in registry HKLM/System ... and now you will be able to install the server again with same service name!

How to repeat:
Simply install, uninstall, (reboot if you like) and (try to) reinstall specifying same service name. Inspect the "Computer Management .. Services" menu and the registry.

Suggested fix:
I am not sure if this is a Win7 issue.  I suspect it is an issue with the uninstaller shipped with the 64 bit server on all Windows 64 bit platforms (XP,Vista, Win7 - but the only 64 bit WIndows OS I have available is Win7). I have never had similar problems with 32 bit servers on 32 bit Windows (from XP before SP1 to Vista SP1).

However, if it is an issue specific for Win7 the idea with releasing Win7 RC is that vendors should get in dialogue with Microsoft to get this resolved before final release (just like MySQL asks people to test clients and applciations on RC servers so that issues can be corrected before final release)
[23 May 2009 18:54] Peter Laursen
service is removed in Control Panel .. Software but not in Computer Management .. Services

Attachment: after uninstall.jpg (image/jpeg, text), 47.18 KiB.

[23 May 2009 19:21] MySQL Verification Team
Thank you for the bug report. Verified in Vista Home Premium, below the error message after the uninstall and reboot:

Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>net start MySQL51
System error 3 has occurred.

The system cannot find the path specified.

C:\Windows\system32>

Which shows the service name exists and the lack of the binary path.
[23 May 2009 19:49] MySQL Verification Team
Just one note. Don't edit the Registry to remove the orphan service after the application was removed via Control Panel, that could be done with a standalone server like showed below:

C:\dbs>5.1\bin\mysqld --remove MySQL51
Service successfully removed.
[23 May 2009 20:37] Peter Laursen
"Just one note. Don't edit the Registry to remove the orphan service
after the application was removed via Control Panel, that could be done
with a standalone server .. "

So I would need to download a 'no-install' server version, unpack it and execute this (or install wiht another service name, do as describe and uninstall and then finally install with the service name I want)? Removing service entries from registry HKLM\'*ControlSet*'\Services is much faster and simpler! But OK that the option is there if somebody do not feel confident with Regedit! I also fully understand that MySQL will not advice users to manipulate the registry .. but better then fix this problem with the uninstaller so that there will be no need for it! :-)

(that said, it is actually annoying that Windows does not have GUI option to remove a service.  MySQL, Apache etc, services is little problem but the different SSHD implementations for Windows (Cygwin, Bitvise) can be very tricky to handle with Regedit!)
[23 May 2009 21:00] MySQL Verification Team
Windows has the command tool sc:

C:\dbs\5.1\bin>sc
DESCRIPTION:
        SC is a command line program used for communicating with the
        Service Control Manager and services.
USAGE:
        sc <server> [command] [service name] <option1> <option2>...

        The option <server> has the form "\\ServerName"
        Further help on commands can be obtained by typing: "sc [command]"
        Commands:
          query-----------Queries the status for a service, or
                          enumerates the status for types of services.
          queryex---------Queries the extended status for a service, or
                          enumerates the status for types of services.
          start-----------Starts a service.
          pause-----------Sends a PAUSE control request to a service.
          interrogate-----Sends an INTERROGATE control request to a service.
          continue--------Sends a CONTINUE control request to a service.
          stop------------Sends a STOP request to a service.
          config----------Changes the configuration of a service (persistent).
          description-----Changes the description of a service.
          failure---------Changes the actions taken by a service upon failure.
          failureflag-----Changes the failure actions flag of a service.
          sidtype---------Changes the service SID type of a service.
          privs-----------Changes the required privileges of a service.
          qc--------------Queries the configuration information for a service.
          qdescription----Queries the description for a service.
          qfailure--------Queries the actions taken by a service upon failure.
          qfailureflag----Queries the failure actions flag of a service.
          qsidtype--------Queries the service SID type of a service.
          qprivs----------Queries the required privileges of a service.
          delete----------Deletes a service (from the registry).
[23 May 2009 21:59] Peter Laursen
Network administrators will use this. But 95% of Windows users will use Regedit (whether you like it or not) simply because they know it - and besides the sc (Service Control) command with delete option will do exactly as what I did with Regedit! 

As most windows users I prefer to use a self-explanatory GUI program and not some command that I need to look up (and not *at all* a unix type command syntax "blah --bluh").

But as this bug will be fixed on Monday this discussion is not really important! :-)
[24 May 2009 13:45] Peter Laursen
just tried: not reproducable on 32 bit Vista with 32 bit 5.1.34 server.
[12 Jan 2010 9:26] Tonci Grgin
Same behavior observed on Win7 Ultimate x64 (in VBox) usinf MySQL 5.1.42 x64 Win msi.

Manually removing the service (mysqld --remove) *marks* it for deletion though.
[26 Apr 2010 19:04] Aaron Poole
This bug still seems to be persistent in 5.5.3-m3.
[26 Apr 2010 19:11] Aaron Poole
I stand corrected, the Service was removed.  My troubles are unrelated.
[2 Oct 2010 8:16] Peter Laursen
I have not seen this for very long time in recent 5.1 and 5.5.  Maybe this is now a "can't repeat" ?
[3 Nov 2010 0:06] Bornali Dev
same happens on win 2008 server. The service does not get removed upon uninstall.
[3 Nov 2010 9:33] MySQL Verification Team
Bug http://bugs.mysql.com/bug.php?id=57940 marked as duplicate of this one.
[25 Jan 2011 23:13] Jim Goodwin
I have Windows 7.  Installed originally using mysql-essential-5.1.52-win32.msi.  Uninstall did not remove the service.

I stopped the service before running the uninstaller via Windows Control Panel.
[1 Feb 2011 15:13] John Corley
I am having the same problem after attempting to uninstall MySQL 5.5.8-winx64 on Microsoft
Server 2008 r2. It is hanging up during the re-install at the point it tries to start the
service.

Does anyone have a work around or solution? Any input would be greatly appreciated.
[1 Feb 2011 15:19] Peter Laursen
Just remove the service from commandline "sc delete <servicename>".  But I did not (as far as I remember) experience a 'hang'. It just failed to remove the service from Registry.
[9 Feb 2011 22:47] Jonathan Livni
This happened to me today too. I removed the service, but I too think the installation should take care of it.
[9 Feb 2011 22:48] Jonathan Livni
Forgot to mention the version I'm using in the comment above: mysql-5.5.9-winx64.msi
I'm using Win7 64bit
[14 Mar 2011 4:07] Valeriy Kravchuk
Bug #60446 was marked as a duplicate of this one.
[17 Mar 2011 15:50] brendan mckenna
Windows 7/XP/Server 2003:

Have been dealing with installing/uninstalling mysql repeatedly in our test environment.  Not only does the MySQL uninstaller not remove the service, it does not remove \ApplicationData\[user]\MySQL.

I think in summary we need a smooth uninstaller which COMPLETELY removes MySQL, does not leave old database files, and does not leave old configuration files.  Basically we need it to ACTUALLY UNINSTALL MYSQL so upon a reinstall it is as though MySQL never resided on the PC.
[17 Mar 2011 15:53] Peter Laursen
It should in my opinion *not* remove the data folder.  But it could be an option.
[26 Jan 2017 6:34] Erlend Dahl
Posted by developer:

[19 Jan 2017 5:49] Piotr Obrzut

This issue doesn't show in the newer and supported versions.
[2 Apr 2019 19:13] Kerry Coates
This problem still exists in Windows 10 running IIS 10. Trying to install WP and all it does is hang. After all the reading about this issue on the net you would think that the Web platform 5.1 is crap. I can only imagine people who are new to the web and want to install a simple program as Wordpress run into these issues.
My only words for this is Microsoft