SHIN
SHIN

Reputation: 97

How can i check the mysql server is installed or not before installing the application in Inno setup compiler

I need inno setup compiler script to check whether mysql server is installed or not before installing the application.

Upvotes: 4

Views: 47535

Answers (1)

Gangadhar
Gangadhar

Reputation: 10526

MySQL is quit differ than other ones, we can also use MySQL with out installing into our system by running required services time to time from the downloaded zip archives, extracted files may be placed any where on the system...Tlama Already mentioned this.

Here we have two cases to Check

Case 1:-MySQL is installed or not

Direxists function(Here you can Check whether MySQL directory exists in program files or not )
MySQL directory path :{pf}\MySQL

Filexists function(with this you can check required MySQL files are there in the users systems )

Query the registry with the MySQL registry Key names

HKEY_USERS\S-1-5-21-1707045092-1792370289-147592793-1000\Software\MySQL
HKEY_USERS\S-1-5-21-1707045092-1792370289-147592793-1000\Software\MySQL AB HKEY_CURRENT_USER\Software\MySQL
HKEY_CURRENT_USER\Software\MySQL AB
check whether these are existed in registry or not.

if Every thing is existed, that's fine. Go for your application installation

if no check for case 2 also

Case 2:- Is there any files or directories with the name of MySQL in the entire system and required services of Mysql are running or not

a. first check whether is there any file or folder exists with the name of MySQL in the users machine by using below commands, to execute commands you can use Exec function

with the below one you can find whether MySQL(file/directory) is there in c drive or not, but not in entire system

C:\>tree |find "mysql" >filename

b)now change the drive to D,E,F by using

below command will give you , all disk drives in the machine

C:\>wmic logicaldisk get caption >filename

then check each and every drive in the above filename

 C:\>D:  
 d:\>tree |find "mysql" >filename

each time Loadstringfromfile to some string and then check the length of string is zero or not. if not zero, you need to check for required services are running or not by using (you can skip some above steps for simplicity)

tasklist |find "required service of MySQL" >filename 

if all drives finished and if did not found any thing, no worries simply prompt user to download MySQL (Use ITD(Innoo tools downloader)) or else you can pack MySQL msi with your application but your application become bulky(Contains more memory).

Upvotes: 2

Related Questions