I'm trying to launch mysqldump from my C# console application using this code:
ProcessStartInfo procInfo = new ProcessStartInfo("mysqldump", "avisdb -uroot -p" + cs.Password);
procInfo.CreateNoWindow = true;
procInfo.RedirectStandardOutput = true;
procInfo.UseShellExecute = false;
Process proc = new Process();
proc.StartInfo = procInfo;
proc.Exited += new EventHandler(proc_Exited);
proc.Start();
proc.WaitForExit();
File.Delete("dump.sql");
StreamWriter dump = File.AppendText("dump.sql");
dump.Write(proc.StandardOutput.ReadToEnd());
dump.Flush();
dump.Close();
it works great when my db is empty, but it takes forever when DB is populated... Launching the command via cmd it takes just a few seconds. I can see it stalls on proc.WaitForExit()
Thanks in advance!