Dear gurus,
I already tried this script for almost one week, and still can't find the best to resolve this.
I am making installation package application VB6 along with MySQL installation (service, odbc, etc)
Code:
; Install Script for icDagangv1
; [Inno Setup Toolbar Advanced - Script Wizard]
;
; Generated by the 'Inno Setup Toolbar Advanced for Visual Basic 6.0'
; Written and Programmed by Brian Haase and Martin Rizal
;
; Generated for Inno Setup Compiler, Version 4+
;
[Setup]
AppName=Sistem POS icDagang
AppVerName=Sistem Pos icDagang
AppPublisher=I-CON
DefaultDirName={pf}\icDagangv1
DefaultGroupName=icDagangv1
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
WizardImageFile=C:\Program Files (x86)\Inno Setup 6\WizModernImage-IS.bmp
WizardSmallImageFile=C:\Program Files (x86)\Inno Setup 6\WizModernSmallImage-IS.bmp
[Tasks]
;Installation Task
Name: vb6; Description: Visual Basic 6.0 Core Runtime Library; GroupDescription: Install Component(s):; Check: NeedVB('6.0.98.15');
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: installmysql; Description: "Install MySQL"; GroupDescription: "Installing MySQL 8.0"; Flags: checkedonce
[Files]
;Program files for deployment
;Executable File or Main Component
Source: "icDagangv1.exe"; DestDir: {app}; Flags: ignoreversion 32bit
;Visual Basic 6.0 Runtime Files
Source: MSVCRT40.DLL; DestDir: {sys}; Flags: onlyifdoesntexist uninsneveruninstall sharedfile 32bit allowunsafefiles; Tasks: vb6
Source: OLEPRO32.DLL; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile regserver noregerror 32bit allowunsafefiles; Tasks: vb6
Source: COMCAT.DLL; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile regserver noregerror 32bit allowunsafefiles; Tasks: vb6
Source: ASYCFILT.DLL; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile 32bit allowunsafefiles; Tasks: vb6
Source: OLEAUT32.DLL; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile regserver noregerror 32bit allowunsafefiles; Tasks: vb6
Source: STDOLE2.TLB; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile 32bit allowunsafefiles; Tasks: vb6
Source: msvbvm60.dll; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile regserver noregerror 32bit allowunsafefiles; Tasks: vb6
;daftar file MySQL
Source: mySQL8\bin\*; DestDir: {app}\mysql\bin; Flags: ignoreversion; Tasks: installmysql
Source: mySQL8\Docs\*; DestDir: {app}\mysql\Docs; Flags: ignoreversion; Tasks: installmysql
Source: mySQL8\lib\*; DestDir: {app}\mysql\lib; Flags: ignoreversion recursesubdirs; Tasks: installmysql
Source: mySQL8\include\*; DestDir: {app}\mysql\include; Flags: ignoreversion recursesubdirs; Tasks: installmysql
Source: mySQL8\share\*; DestDir: {app}\mysql\share; Flags: ignoreversion recursesubdirs; Tasks: installmysql
Source: mySQL8\etc\*; DestDir: {app}\mysql\etc; Flags: ignoreversion recursesubdirs uninsneveruninstall; Tasks: installmysql
Source: mySQL8\*; DestDir: {app}\mysql; Flags: ignoreversion; Tasks: installmysql
;daftar file MySQL ODBC 8.0
Source: "C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8a.dll"; DestDir: {sys}; Flags: onlyifdoesntexist
Source: "C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8s.dll"; DestDir: {sys}; Flags: onlyifdoesntexist
Source: "C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8w.dll"; DestDir: {sys}; Flags: onlyifdoesntexist
Source: "C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8a.lib"; DestDir: {sys}; Flags: onlyifdoesntexist
Source: "C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8s.lib"; DestDir: {sys}; Flags: onlyifdoesntexist
Source: "C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8w.lib"; DestDir: {sys}; Flags: onlyifdoesntexist
Source: "C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8a.pdb"; DestDir: {sys}; Flags: onlyifdoesntexist
Source: "C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8s.pdb"; DestDir: {sys}; Flags: onlyifdoesntexist
Source: "C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8w.pdb"; DestDir: {sys}; Flags: onlyifdoesntexist
Source: "C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc-installer.exe"; DestDir: {sys}; Flags: onlyifdoesntexist
;Dependencies and Files
Source: "arpro2.dll"; DestDir: {cf}\Data Dynamics\ActiveReports Pro; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{cf}\Data Dynamics\ActiveReports Pro\arpro2.dll'));
Source: "MSBIND.DLL"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\MSBIND.DLL'));
Source: "MSStdFmt.Dll"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\MSStdFmt.Dll'));
Source: "ARVIEW2.OCX"; DestDir: {cf}\Data Dynamics\ActiveReports Pro; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{cf}\Data Dynamics\ActiveReports Pro\ARVIEW2.OCX'));
Source: "ardespro2.dll"; DestDir: {cf}\Data Dynamics\ActiveReports Pro; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{cf}\Data Dynamics\ActiveReports Pro\ardespro2.dll'));
Source: "exclexpt.dll"; DestDir: {cf}\Data Dynamics\ActiveReports Pro; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{cf}\Data Dynamics\ActiveReports Pro\exclexpt.dll'));
Source: "htmlexpt.dll"; DestDir: {cf}\Data Dynamics\ActiveReports Pro; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{cf}\Data Dynamics\ActiveReports Pro\htmlexpt.dll'));
Source: "pdfexpt.dll"; DestDir: {cf}\Data Dynamics\ActiveReports Pro; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{cf}\Data Dynamics\ActiveReports Pro\pdfexpt.dll'));
Source: "rtfexpt.dll"; DestDir: {cf}\Data Dynamics\ActiveReports Pro; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{cf}\Data Dynamics\ActiveReports Pro\rtfexpt.dll'));
Source: "textexpt.dll"; DestDir: {cf}\Data Dynamics\ActiveReports Pro; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{cf}\Data Dynamics\ActiveReports Pro\textexpt.dll'));
Source: "tiffexpt.dll"; DestDir: {cf}\Data Dynamics\ActiveReports Pro; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{cf}\Data Dynamics\ActiveReports Pro\tiffexpt.dll'));
Source: "MSCOMCTL.OCX"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\MSCOMCTL.OCX'));
Source: "LaVolpeImageList.ocx"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\LaVolpeImageList.ocx'));
Source: "jcMDITabs.ocx"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\jcMDITabs.ocx'));
Source: "LaVolpeAlphaImg2.ocx"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\LaVolpeAlphaImg2.ocx'));
Source: "vkusercontrolsxp.ocx"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\vkusercontrolsxp.ocx'));
Source: "prjXTab.ocx"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\prjXTab.ocx'));
Source: "EyeDropper.ocx"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\EyeDropper.ocx'));
Source: "MSCAL.OCX"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\MSCAL.OCX'));
Source: "COMDLG32.OCX"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\COMDLG32.OCX'));
Source: "COMCT232.OCX"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\COMCT232.OCX'));
Source: "MSCOMCT2.OCX"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\MSCOMCT2.OCX'));
Source: "OsenDatel.ocx"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\OsenDatel.ocx'));
Source: "MSHFLXGD.OCX"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\MSHFLXGD.OCX'));
Source: "COMCT332.OCX"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\COMCT332.OCX'));
Source: "ComboBoxLB.ocx"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\ComboBoxLB.ocx'));
Source: "HookMenu15.ocx"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\HookMenu15.ocx'));
Source: "VBFLXGRD14.OCX"; DestDir: {sys}; Flags: regserver noregerror 32bit allowunsafefiles; Check: FileNotFound(ExpandConstant('{sys}\VBFLXGRD14.OCX'));
Source: "vcredist\vc_redist.x86.exe"; DestDir: "{tmp}";
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
;Shortcut Icons
Name: "{userstartmenu}\icDagangv1\icDagangv1"; Filename:"{app}\icDagangv1.exe"
Name: "{userdesktop}\Sistem icDagang"; Filename: "{app}\icDagangv1.exe"; Tasks: desktopicon
[INI]
;Filename: {app}\mysql\my.ini; Section: mysqld; Key: basedir; String: {app}\mysql; Tasks: installmysql
;Filename: {app}\mysql\my.ini; Section: mysqld; Key: datadir; String: {app}\mysql\data; Tasks: installmysql
[Registry]
;For accessing Windows registry
[Run]
; Installing MySQL installation package, which by default goes to C:\Program Files\MySQL\
; /qn also makes msiexec go quiet and unattended.
;Filename: msiexec.exe; Parameters: "/i ""{tmp}\mysql-installer-community-8.0.20.0.msi""/ qn";WorkingDir: {tmp};StatusMsg: "Sedang menginstall MySQL Server Installer 8.0";Flags: runhidden
; Using the MySQLInstallerConsole.exe to install the MySQL server. We need to set the type of installation
; ( -t ) to Custom to make it install only the server ( and omit for example Workbench ). We need to set the
; initial root password ( below set to root ). Lack of --nowait makes the console wait for user input.
;Filename: "C:\Program Files\MySQL\MySQL Installer for Windows\MySQLInstallerConsole.exe";Parameters: " --action=install -t=Custom --config=mysql-server-5.7-win32:passwd=root --product=mysql-server-5.7-win32 --catalog=mysql-5.7-win32 --nowait";StatusMsg: "Installing MySQL Server";Flags: runhidden
; Quite self explanatory, we just add mysql service to services currently running on the pc
;Filename: "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe"; Parameters:" --install";WorkingDir: {app};StatusMsg: "Installing MySQL Service";Flags: runhidden
; Starting the service
;Filename: net.exe;Parameters: start mysql;StatusMsg: "Memulai MySQL Server";Flags: runhidden
;Run misc. process
;Addtional Task
;run MVC++ 2015 Redist
Filename: "{tmp}\vc_redist.x86.exe"; Parameters: "/Silent"; StatusMsg: "Sedang menginstall Microsoft VC++ 2015"; Flags: runhidden; MinVersion: 0,5.01.2600sp2; Tasks: installmysql
;install service MySQL
Filename: "{app}\mysql\bin\mysqld.exe"; Parameters: "install ""MySQL"""; StatusMsg: "Sedang menginstall service MySQL 8.0..."; Flags: runhidden; MinVersion: 0,5.01.2600sp2; Tasks: installmysql
;initialize the service
Filename: "{app}\mysql\bin\mysqld.exe"; Parameters:" --initialize";WorkingDir: {app};StatusMsg: "Initializing MySQL Service";Flags: runhidden
;jalankan service MySQL
Filename: {sys}\net.exe; Parameters: "Start ""MySQL"""; StatusMsg: "Sedang menjalankan service MySQL 8.0..."; Flags: runhidden; MinVersion: 0.0,4.0.1381; Tasks: installmysql
;mendaftarkan port default mysql (3306) ke firewall
Filename: "{sys}\netsh.exe"; Parameters: "firewall add portopening TCP 3306 ""Port MySQL"""; StatusMsg: "Sedang mendaftarkan port MySQL ..."; Flags: runhidden; MinVersion: 0,5.01.2600sp2
Filename: "{sys}\netsh.exe"; Parameters: "firewall set service type = fileandprint mode = enable"; StatusMsg: "Mengaktifkan File and Printer Sharing ..."; Flags: runhidden; MinVersion: 0,5.01.2600sp2
;mengganti password default root (blank). ex : masterkey
Filename: "{app}\mysql\bin\mysqladmin.exe"; Parameters: "-uroot password masterkey"; StatusMsg: "Mengganti password root"; Flags: runhidden; MinVersion: 0,5.01.2600sp2
;menghapus user default1 (user=blank, password=blank)
Filename: "{app}\mysql\bin\mysql.exe"; Parameters: "-uroot -pmasterkey -e ""DELETE FROM mysql.user WHERE Host='localhost' AND User=''"""; Flags: runhidden; MinVersion: 0,5.01.2600sp2
Filename: "{app}\mysql\bin\mysql.exe"; Parameters: "-uroot -pmasterkey -e ""FLUSH PRIVILEGES"""; Flags: runhidden; MinVersion: 0,5.01.2600sp2
;menghapus user default2 (user=root, password=blank)
Filename: "{app}\mysql\bin\mysql.exe"; Parameters: "-uroot -pmasterkey -e ""DELETE FROM mysql.user WHERE Host='127.0.0.1' AND User='root'"""; Flags: runhidden; MinVersion: 0,5.01.2600sp2
Filename: "{app}\mysql\bin\mysql.exe"; Parameters: "-uroot -pmasterkey -e ""FLUSH PRIVILEGES"""; Flags: runhidden; MinVersion: 0,5.01.2600sp2
;set agar user root bisa login dari mesin lain (kalo diperlukan)
Filename: "{app}\mysql\bin\mysql.exe"; Parameters: "-uroot -pmasterkey -e ""GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'masterkey'"""; Flags: runhidden; MinVersion: 0,5.01.2600sp2
Filename: "{app}\mysql\bin\mysql.exe"; Parameters: "-uroot -pmasterkey -e ""FLUSH PRIVILEGES"""; Flags: runhidden; MinVersion: 0,5.01.2600sp2
;install driver myodbc
Filename: "{sys}\myodbc-installer.exe"; Parameters: "-d -a -n ""MySQL ODBC 8.0 ANSI Driver"" -t ""DRIVER=myodbc8a.dll;SETUP=myodbc8a.dll"""; StatusMsg: "Tunggu sedang mendaftarkan driver MySQL Connector ANSI ODBC 8.0"; Flags: runhidden
Filename: "{sys}\myodbc-installer.exe"; Parameters: "-d -a -n ""MySQL ODBC 8.0 Unicode Driver"" -t ""DRIVER=myodbc8a.dll;SETUP=myodbc8w.dll"""; StatusMsg: "Tunggu sedang mendaftarkan driver MySQL Connector UNICODE ODBC 8.0"; Flags: runhidden
[UninstallRun]
Filename: {sys}\net.exe; Parameters: "stop ""MySQL"""; StatusMsg: "Menghentikan Service MySQL ..."; Flags: runhidden; MinVersion: 0.0,4.0.1381
Filename: "{app}\mysql\bin\mysqld.exe"; Parameters: "remove ""MySQL"""; StatusMsg: "Sedang menghapus service MySQL ..."; Flags: runhidden; MinVersion: 0,5.01.2600sp2
Filename: "{sys}\myodbc-installer.exe"; Parameters: "-d -r -n ""MySQL ODBC 5.1 Driver"""; StatusMsg: "Tunggu sedang menghapus driver MySQL Connector ODBC 5.1.5"; Flags: runhidden
[UninstallDelete]
Type: files; Name: {app}\mysql\bin\*.*
Type: files; Name: {app}\mysql\Docs\*.*
Type: files; Name: {app}\mysql\lib\*.*
Type: files; Name: {app}\mysql\share\*.*
Type: files; Name: {sys}\myodbc5S.dll
Type: files; Name: {sys}\myodbc5S.lib
Type: files; Name: {sys}\myodbc5.dll
Type: files; Name: {sys}\myodbc5.lib
Type: files; Name: {sys}\myodbc-installer.exe
Here is the step for installation :
1. Install Program
2. Install MySQL
3. Install ODBC
4. Running MySQL along with services
5. Define the ODBC MySQL 8.0 ANsi Driver
What I didn't do in installation is "Creating Database" because my app will create database and tables.
My Problem :
If I am not mistaken, the mySQL service will have user :root and password : masterkey, but I tried to connect with my program and unable to connect.
When I checked the ODBC via Control Panel->Administrative.. I can't find the ODBC for mySQL
But If I am using the command prompt "odbcad32" (somehow it show ODBC dialog) and I can see the MySql ODBC installed in drivers.
Please help, what's wrong with my script. Anyone can suggest what the best way to install mySQL during installation app (with silent and no need user interaction).
Thanks