I am restoring backup in MySql. But the mysql exe is not terminating. This is my code -
public override bool FullRestore(Stream fileStream)
{
try
{
ProcessStartInfo proc = new ProcessStartInfo();
string cmd = string.Format("--database {0} --user={1} --password={2}", config.GetDbName(), config.GetUserName(), config.GetPassword());
proc.FileName = "mysql";
proc.RedirectStandardInput = true;
proc.RedirectStandardOutput = false;
proc.Arguments = cmd;
proc.UseShellExecute = false;
proc.CreateNoWindow = true;
Process p = Process.Start(proc);
Stream stream = p.StandardInput.BaseStream;
Stream file = Utility.ZipNEncrypt.Unzip(fileStream, "XXXXXX");
byte[] bytes = new byte[1024];
for (int count = 0; (count = file.Read(bytes, 0, 1024)) > 0; )
{
stream.Write(bytes, 0, count);
}
stream.Flush();
p.WaitForExit();
file.Close();
return true;
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show(e.ToString());
return false;
}
}
My BackUp method working well, but this method is not working.(They are vary much similar)
Any Suggestions?