Here is the use of mysqlbackup, which can then be downloaded in NuGet.
Can not solve the problem of view ungrateful error, only the table with the data is appropriate, if there is a view embedded view, please refer to the MySQL backup migration--mysqldump (. NET call Mysqldump.exe mode)--(to resolve the view Embedded ungrateful error) http:/ Www.cnblogs.com/pbys/p/4142367.html
stringConstring ="server=192.168.0.1;port=3306;user=root; pwd=123456; database=test1;allow zero datetime = TRUE;"; stringFile ="C:\\backup.sql"; System.IO.MemoryStream Ms=NewSystem.IO.MemoryStream ();//how to export to memory using(Mysqlconnection conn =Newmysqlconnection (constring)) { using(Mysqlcommand cmd =NewMysqlcommand ()) { using(Mysqlbackup MB =Newmysqlbackup (CMD)) {cmd. Connection=Conn; Conn. Open (); //MB. Exportinfo.addcreatedatabase = true;//do you need to create a database//MB. exportinfo.exporttablestructure = true;//Export Table Structure//MB. Exportinfo.exportrows = true;//Export DataMb. Exportinfo.exportviews =false;//view does not guideMb.Command.CommandTimeout = -; Mb. Exporttofile (file); // How to export to a file //MB. Exporttomemorystream (MS);//how to export to memoryConn. Close (); } }} constring="server=192.168.0.2;port=3306;user=root; pwd=123456; database=test1;allow zero datetime = TRUE;"; using(Mysqlconnection conn =Newmysqlconnection (constring)) { using(Mysqlcommand cmd =NewMysqlcommand ()) { using(Mysqlbackup MB =Newmysqlbackup (CMD)) {cmd. Connection=Conn; Conn. Open (); //MB. Importinfo.targetdatabase = "Test2"; //MB. Importinfo.databasedefaultcharset = "UTF8";Mb.Command.CommandTimeout = -;MB. ImportFromFile (file); // How to export to a file //MB. Importfrommemorystream (MS);//how to export to memoryConn. Close (); } } }
For more parameters and updates, please refer to Http://www.codeproject.com/Articles/256466/MySqlBackup-NET
MySQL Backup migration--mysqlbackup--(Unable to resolve view ungrateful error)