Backup MySQL database from client host using CMD

117 views Asked by At

I have two windows PC name like A,B it have peer to peer connection pc A have installed MySQL 5.6 and I need to take backup database from A (server ip192.168.1.2) to B (client) using CMD I try this code but getting empty file size I'm newbie to MySQL thank you.

string fileName = DateTime.Now.ToString("yyyy-MM-dd-HHmm");
  
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";

startInfo.Arguments = "/C mysqldump -h 192.168.1.2 -p 3306 -u root -p1234 sms > d:/backup/" + fileName + ".sql";
process.StartInfo = startInfo;
process.Start();
0

There are 0 answers