Click here to Skip to main content
16,013,207 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
I have designed a C# application that uses mysql database. I would like to install the application together with the mysql server if it is not already on the system. I created an installer class and inside the
C#
public override void Commit(IDictionary savedState)
function, the code below was included:
C#
if (!isMySQLInstalled)
{
    // Starts the installation of the mysql community server
    Process p = new Process();
    p.StartInfo.FileName = "msiexec.exe";
    p.StartInfo.Arguments = string.Format(" /q /log install.txt /i " +
                            context.Parameters["TARGETDIR"].ToString() + "MySQL_Setup.exe" +
                            " datadir=\"C:\\Program Files\\MySQL\\MySQL Server 5.0\" " +
                            "installdir=\"C:\\Program Files\\MySQL\\MySQL Server 5.0\\data\"");
    p.Start();
    p.WaitForExit();

    // Starts the configuration of the mysql server
    p = new Process();
    p.StartInfo.FileName = "C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\MySQLInstanceConfig.exe";
    p.StartInfo.Arguments = string.Format(" -i -q \"-lC:\\mysql_install_log.txt\" \"-nMySQL Server 5.0.51\" " +
                                        "\"-pC:\\Program Files\\MySQL\\MySQL Server 5.0\" -v5.0.51  " +
                                        "\"-tC:\\Program Files\\MySQL\\MySQL Server 5.0\\my-template.ini\" " +
                                        "\"-cC:\\Program Files\\MySQL\\MySQL Server 5.0\\mytest.ini\" " +
                                        "ServerType=DEVELOPMENT DatabaseType=MIXED " +
                                        "ConnectionUsage=DSS Port=3306 ServiceName=MySQL " +
                                        "RootPassword=nevermind AddBinToPath=yes");
    p.Start();
    p.WaitForExit();
}

if (!isMySQLODBCConnectorInstalled)
{
    Process p = new Process();
    p.StartInfo.FileName = "msiexec.exe";
    p.StartInfo.Arguments = string.Format(" /q /log install.txt /i " +
                            context.Parameters["TARGETDIR"].ToString() + "mysql-connector-odbc-5.2.5-win32.msi");
    p.Start();
    p.WaitForExit();
}


The main purpose is that I would like to install the mysql server together with its ODBC connector silently. But a trial installation has always proved futile. I am stucked and do not know where to go. I have tried to google it for aids but to no avail. I will be very glad if any help is extended to me. Thanks.
Posted
Updated 13-Sep-13 13:52pm
v3
Comments
Hosam Alaa 13-Jun-19 13:32pm    
can i have the full code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900