This project has moved. For the latest updates, please go here.

Example of Using the Class: MySQLBackupRestore.cs

Download and locate 2 class: MySQLBackupRestore.cs and XCrypt.cs

(Special thanks to XCrypt project which enables the encryption function) 

XCrypt Project Site: XCrypt - encryption & decryption class wrapper 

Add the two class into your project. Add this command at the top of your project:

Using MySql.Data.MySqlClient; 

To Backup:

MySqlBackupRestore mb = new MySqlBackupRestore();
mb.myServer = "localhost";
mb.myUser = "root";
mb.myPassword = "qwerty";
mb.myDatabase = "people";
mb.myPort = "3306";
mb.DropAndRecreateDatabase = true;
mb.DropAndRecreateTable = true;
mb.Construct_SQL_In_One_Line_From_Same_Table = true;
mb.EncryptBackupFile = true;;
mb.EncryptionKey = "asdf";
mb.Backup("C:\\backup.sql");

To Restore: 

MySqlBackupRestore mb = new MySqlBackupRestore();
mb.myServer = "localhost";
mb.myUser = "root";
mb.myPassword = "qwerty";
mb.myPort = "3306";
mb.EncryptBackupFile = true; ;
mb.EncryptionKey = "asdf";
mb.Restore("C:\\backup.sql");

Last edited Sep 28, 2011 at 2:24 AM by adriancs, version 2