Objective
Implementation principle:
Integrate a MySQL folder that is already configured, and then configure the MySQL service through the. bat file. Implementing a free-install MySQL database
BUG: Because it is integrated with an already installed MySQL folder, it is similar to installing a green version of MySQL. The MySQL service is not uninstalled when it is uninstalled and needs to be removed manually. There is no good solution for the moment.
Integrate MySQL into the package installer. A full backup of the folder that has the MySQL program installed is used to integrate the installation program.
Create a new Mysqlstart.bat file under the bin folder of MySQL
Write the following content, 1-19 lines to get the cmd window administrator rights, 21-23 lines in the Windows service to configure the MySQL service
1 @echo off2>nul2>&1 "%systemroot%\system32\cacls.exe" "%SystemRoot%\System32\Config\SYSTEM" 3 4 if '%errorlevel%'NEQ'0' ( 5 Gotouacprompt6)Else(Gotogotadmin)7 8 : Uacprompt9echo Set UAC = createobject^ ("shell.application"^) >"%temp%\getadmin.vbs" TenEcho UAC. ShellExecute"%~s0","","","runas",1>>"%temp%\getadmin.vbs" One "%temp%\getadmin.vbs" AExit/B - - : Gotadmin the ifExist"%temp%\getadmin.vbs"(Del"%temp%\getadmin.vbs" ) -pushd"%cd%" -cd/d"%~dp0" - + : Begin - +CD/D%~dp0 A "%cd%\mysqld.exe"-Install Mysql atnet start Mysql
1) Open the Inno Setup 5 applet and pop up the following interface:
2) Click on the menu bar "File"--"new, the following screen appears
3) Click Next and the following screen appears
4) Click Next and the following screen appears
5) No changes required, continue clicking Next
6) Here the integrated package to install the MySQL database, click on Add folder, the entire MySQL folder to add (that is, select the previous backup of the MySQL folder).
7) next to the individual needs of the detailed information changes, you can not modify continue to click Next, always point to
Finish. Then the following interface appears
8) If you need to compile the script, point No, do not compile the script
9) at the end
[Run] (files that run automatically after loading)
At the bottom, add the bat file on the MySQL configuration service
Filename: "{app}\mysql-5.1.37-win32\bin\mysqlstart.bat"; Flags:nowait Runhidden; (Used to configure the startup MySQL service)
After adding this sentence, click Run to execute the compile script
Package MySQL integration into a setup program for one-click installation