• 0

how can Backup of mysql using C#


Question

hello sir,

will you plz tell me how can i take backup of mysql using windows Form in C#. if i click the button of Back Up then back up should be completed.

thanks in Advance

Naim Khan

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
Have you program call the executables (mysqldump) they've already created.

http://dev.mysql.com/doc/refman/5.1/en/backup.html

+1

You can use the Process type to call an executable:

using System.Diagnostics;

public void Backup() {
  string path = "mysqldump ...";
  Process.Start(path);
}

where path is the path to the mysqldump executable with parameters...

Link to comment
Share on other sites

  • 0

You can use the mysqldump reference to learn about the attribut using mysqldump at

http://dev.mysql.com/doc/refman/5.1/en/backup.html

and you can call it using Process method to call the mysqldump

using System.Diagnostics;
.
.
.
public void Backup()
{
	  Process backup = new Process();
	  backup.StartInfo.FileName = @"[your mysql installation path]\mysqldump.exe";
	  backup.StartInfo.Arguments = "[db_name] > [backup-file.sql]";
	  backup.Start();
	  //if you wanted to wait until the backup process finished
	  backup.WaitForExit();
}

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.