MySqlBackup.Net.DevartExpress 2.3.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package MySqlBackup.Net.DevartExpress --version 2.3.7                
NuGet\Install-Package MySqlBackup.Net.DevartExpress -Version 2.3.7                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MySqlBackup.Net.DevartExpress" Version="2.3.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MySqlBackup.Net.DevartExpress --version 2.3.7                
#r "nuget: MySqlBackup.Net.DevartExpress, 2.3.7"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MySqlBackup.Net.DevartExpress as a Cake Addin
#addin nuget:?package=MySqlBackup.Net.DevartExpress&version=2.3.7

// Install MySqlBackup.Net.DevartExpress as a Cake Tool
#tool nuget:?package=MySqlBackup.Net.DevartExpress&version=2.3.7                

About

A tool to backup and restore MySQL database in C#/VB.NET/ASP.NET.

Runs on MySql.Data.DLL, MySqlConnector.DLL and Devart.Express.MySql.DLL

More documentation is available at the Project Github website.

For MySql.Data.DLL PM> Install-Package MySqlBackup.NET https://www.nuget.org/packages/MySqlBackup.NET/

For dotConnector Devart.Express.MySql PM> Install-Package MySqlBackup.Net.DevartExpress https://www.nuget.org/packages/MySqlBackup.Net.DevartExpress/

For MySqlConnector (MIT) PM> Install-Package MySqlBackup.NET.MySqlConnector https://www.nuget.org/packages/MySqlBackup.NET.MysqlConnector/

Backup/Export a MySQL Database

string constring = "server=localhost;user=root;pwd=qwerty;database=test;convertzerodatetime=true;";

string file = "C:\\backup.sql";

using (MySqlConnection conn = new MySqlConnection(constring))
{
    using (MySqlCommand cmd = new MySqlCommand())
    {
        using (MySqlBackup mb = new MySqlBackup(cmd))
        {
            cmd.Connection = conn;
            conn.Open();
            mb.ExportToFile(file);
            conn.Close();
        }
    }
}

Import/Restore a MySQL Database

string constring = "server=localhost;user=root;pwd=qwerty;database=test;convertzerodatetime=true;";

string file = "C:\\backup.sql";

using (MySqlConnection conn = new MySqlConnection(constring))
{
    using (MySqlCommand cmd = new MySqlCommand())
    {
        using (MySqlBackup mb = new MySqlBackup(cmd))
        {
            cmd.Connection = conn;
            conn.Open();
            mb.ImportFromFile(file);
            conn.Close();
        }
    }
}

Introduction

MySqlBackup.NET is a tool (DLL) that can backup/restore MySQL database in .NET Programming Language. It is an alternative to MySqlDump.

This tool is developed in C# but able to be used in any .NET Language (i.e. VB.NET, F#, etc.).

Another benefit of making this tool is, we don't have to rely on two small programs - MySqlDump.exe and MySql.exe to perform the backup and restore task. We will have better control on the output result in .NET way.

The most common way to backup a MySQL Database is by using MySqlDump and MySQL Workbench.

MySQL Workbench is good for developers, but when comes to the client or end-user, the recommended way is to get every parameter preset and all they need to know is press the big button "Backup" and everything is done. Using MySQL Workbench as a backup tool is not a suitable solution for the client or end-user.

On the other hand, MySqlDump.exe cannot be executed directly from the Web Server. As some providers forbid that, MySqlBackup will be helpful in building a web-based (ASP.NET) backup tool.

Features

  • Backup and Restore of MySQL Database
  • Can be used in any .NET Languages.
  • Export/Import to/from MemoryStream
  • Conditional Rows Export (Filter Tables or Rows)
  • Progress Report is Available for Both Export and Import Task.
  • Able to export rows into different modes. (Insert, Insert Ignore, Replace, On Duplicate Key Update, Update)
  • Can be used directly in ASP.NET or web services.

Prerequisite and Dependencies for Development, Compile and Production Usage

MySqlBackup.NET relies on the following component to work.

Option 1: MySql.Data (Connector/NET)

Option 2: Devart Express (dotConnect)

Option 3: MySqlConnector (MIT)

Reminder

Reminder 1

MySqlBackup.NET (or MySqlBackup.DLL) stands on top of MySql.Data.DLL which also stands on top of .NET Framework, which uses UTF8 encoding by default. If your database involves any UTF8 or Unicode Characters. You must use a MySQL database with default character of UTF8 while handling Unicode Characters, such as

  • Western European specific languages, the character of 'À', 'ë', 'õ', 'Ñ'.
  • Russian, Hebrew, India, Arabic, Chinese, Korean, Japanese characters, etc.

You are recommended to apply the connection string option of charset=utf8. Example:

server=localhost;user=root;pwd=mypwd;charset=utf8;

or

server=localhost;user=root;pwd=mypwd;charset=utf8mb4;

Reminder 2

(For MySql.Data connector only) DateTime conversion between MySQL and .NET Framework. In MySQL, there are various of DateTime format, such as null value or Date only data. But, in .NET Framework, there is no null value (or Date only) for DateTime. This error is not caused by MySqlBackup.DLL. MySql.Data.DLL (developed by Oracle) has decided to throw an exception of Data Conversion Error. Therefore, you are strongly recommended to apply the connection string option of convertzerodatetime=true. Example:

server=localhost;user=root;pwd=mypwd;charset=utf8mb4;convertzerodatetime=true;
Product Compatible and additional computed target framework versions.
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.3.8 889 3/7/2023
2.3.7 591 10/18/2022
2.3.6 1,916 10/17/2021
2.3.5.1 458 9/24/2021
2.3.5 355 9/23/2021