akaitora
4th June 2008 20:26 UTC
Uninstalling MySQL
Is anyone here familiar with uninstalling mysql via NSIS?
I looked through the windows registry for some hint as to where the mysql uninstaller will be generally located but I didn't find it. Any freshly baked ideas that you can cook up with be greatly appreciated and ravenously digested!
akaitora
5th June 2008 18:35 UTC
Hey guys, i figured out how to detect and uninstall MySQL.
I used orca to get the GUID of the MySQL installer msi.
Then I wrote the following code to uninstall it.
; Uninstall MySQL
services::GetServiceNameFromDisplayName 'MySQL'
; $0 contains the # of services found that have the name MySQL.
pop $0
; Stop the MySQL service from running if it exists.
${If} $0 > 0
messagebox mb_yesno "Would you like to uninstall MySQL server?" idno dont_uninstall_mysql
push 'MySQL'
push 'stop'
services::SendServiceCommand
Pop $0
Messagebox MB_OK "$0"
; Uninstall MySQL 5.0.51a
ExecWait 'MsiExec.exe /X{3EAB224E-12F7-4EBA-AC0A-A2B10FEEA0E4}' $0
;StrCmp $0 'Ok' success 0
dont_uninstall_mysql:
${EndIf}
Hope it helps someone else in the future.