I am trying to recover MySQL database data from a dump file using C # codes.
I suppose to run the following command: mysql --verbose --user = root --password = qwerty123456 test <C: \ Users \ Default \ testing.SQL
I know that C # does not recognize "<" so I tried several methods, but it still did not work. Can someone help me with this? I want to restore all the data in my database back to MySQL using C # codes.
Thanks in advance.
Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe";
process.StartInfo.Arguments = @"--verbose --user=root --password=qwerty123456 test";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.Start();
StreamReader sr = process.StandardOutput;
sr = File.OpenText(@"C:\Users\Default\testing.SQL");
source
share