My application uses MySQL Server. Elaborated in inno setup script that does the following:
In the [code]
- Install MySQL Server (Ok)
- Install MySQL ODBC Connector (Ok)
- Configure the MySQL Server (Ok)
- Starts a service MySQL on Windows (Ok)
- Installs the application (Ok)
In the [run]
- Uses a batch file to enter User and Password in the User table MySQL (Ok)
- Uses a batch file to create the database application (Ok)
- Starts the application (Ok)
The script worked fine, however I wanted the items 1 and 2 of section [run] were also carried out in the [code] thus:
In the [code]
- Install MySQL Server (Ok)
- Install MySQL ODBC Connector (Ok)
- Configure the MySQL Server (Ok)
- Starts a service MySQL on Windows (Ok)
- Uses a batch file to enter User and Password in the User table MySQL (Error)
- Uses a batch file to create the database application (Error)
- Installs the application (Ok)
In the [run]
- Starts the application (Ok)
But the second scheme is an error in the inclusion of new user and password and the creation of the database. In the [run] this does not occur.
The code I used in [code] to insert User and Password is as follows:
if (CurStep = ssInstall) then
begin WizardForm.ProgressGauge.Style: = npbstMarquee; WizardForm.StatusLabel.Caption: = 'Starting service MySQL on Windows. This may take a few minutes ... ';
if not Exec (ExpandConstant ('{pf} \ MySQL \ MySQL Server 5.5 \ bin \ mysqld.exe'), 'mysql-u root GRANT ALL PRIVILEGES ON *. * TO myusername @ localhost IDENTIFIED BY mypassword WITH GRANT OPTION;' '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
MsgBox ('The MySQL service failed. Code:' + IntToStr (ResultCode) mbInformation, MB_OK);
WizardForm.ProgressGauge.Style: = npbstNormal; WizardForm.StatusLabel.Caption: ='';
end;