title: MySQL database backup using C#
body: <p>I am trying to take back up of a mysql database.
  the code  i am created is </p>
  
  <pre><code>ProcessStartInfo proc = new ProcessStartInfo();
  string cmd = string.Format(@"-u{0} -p{1} -E -R -h{2} {3}", UserName, PWD, hostname, dbname);
  proc.FileName = "Path to mysqldump.exe";
  proc.RedirectStandardInput = false;
  proc.RedirectStandardOutput = true;
  proc.Arguments = cmd;
  proc.UseShellExecute = false;
  Process p = Process.Start(proc);
  string res;
  res = p.StandardOutput.ReadToEnd();
  file.WriteLine(res);
  p.WaitForExit();
  file.Close();
  </code></pre>
  
  <p>The problem is it working correctly when the database size is small but i am getting <code>Out Of Memory Exception</code> when i am trying to take back up of large database (Approximately 800 MB ).</p>