First, you need to add a new Setup project to the current solution.
Refer This
Requirements:
1. DotNet Framework - Setup Project in VS -> Right Click-> Properties-> Click Prerequisites-> Check the required DotNet framework. Select Radio button Download prerequisites from the same location as my application. Now your setup includes this framework too.
2. MySql Setup - Add MySql setup file to the Setup project in VS. It will be automatically installed along with your project setup. User has to create user to connect MySql. Login MySql and Import your database from Sql dump file manually. Or you may develop a small win form to Restore DB. Create a batchfile and write the following code into it from WIN form.
"mysql.exe --host=" + txtHostIP.Text + " --user=" + txtUserName.Text + " --password=" + txtPassword.Text+ " --port=" + txtPort.Text + " --default-character-set=utf8 --comments < " + SqlScriptFile);
Execute the batch file using the following code.
ProcessStartInfo info = new ProcessStartInfo(_installBatchFile);
info.UseShellExecute = false;
info.RedirectStandardError = true;
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.CreateNoWindow = true;
info.ErrorDialog = false;
info.WindowStyle = ProcessWindowStyle.Hidden;
info.WorkingDirectory = GetPathOfMySqlService();
Process process = Process.Start(info);