MySqlBackup.NET
2.6.1
See the version list below for details.
dotnet add package MySqlBackup.NET --version 2.6.1
NuGet\Install-Package MySqlBackup.NET -Version 2.6.1
<PackageReference Include="MySqlBackup.NET" Version="2.6.1" />
<PackageVersion Include="MySqlBackup.NET" Version="2.6.1" />
<PackageReference Include="MySqlBackup.NET" />
paket add MySqlBackup.NET --version 2.6.1
#r "nuget: MySqlBackup.NET, 2.6.1"
#:package MySqlBackup.NET@2.6.1
#addin nuget:?package=MySqlBackup.NET&version=2.6.1
#tool nuget:?package=MySqlBackup.NET&version=2.6.1
MySqlBackup.NET
A versatile tool for backing up and restoring MySQL databases in C#, VB.NET, and ASP.NET.
Latest Release: v2.6 (July 04, 2025)
Change Log
Overview
MySqlBackup.NET is a .NET library (DLL) designed to backup and restore MySQL databases. Compatible with multiple MySQL connectors—MySql.Data.DLL
, MySqlConnector.DLL
, and Devart.Express.MySql.DLL
—it offers a programmatic alternative to tools like MySqlDump, providing greater control and flexibility in .NET environments.
Developed in C#, this library supports any .NET language (e.g., VB.NET, F#) and excels in scenarios where MySqlDump.exe or MySQL Workbench are impractical, such as web-based applications (ASP.NET) or end-user tools with simplified interfaces.
Key Features
- Backup and restore MySQL databases programmatically.
- Supports all .NET languages.
- Export/import via files or
MemoryStream
. - Conditional row exports (filter tables/rows).
- Progress reporting for export and import tasks.
- Flexible row export modes:
INSERT
,INSERT IGNORE
,REPLACE
,ON DUPLICATE KEY UPDATE
,UPDATE
. - Ideal for ASP.NET and web service integration.
Getting Started
Installation
Download
Grab the latest release from: GitHub Releases
NuGet Packages
Install via NuGet Package Manager:
MySqlConnector:
PM> Install-Package MySqlBackup.NET.MySqlConnector
https://www.nuget.org/packages/MySqlBackup.NET.MysqlConnector/MySql.Data Connector:
PM> Install-Package MySqlBackup.NET
https://www.nuget.org/packages/MySqlBackup.NET/Devart Express Connector:
PM> Install-Package MySqlBackup.Net.DevartExpress
https://www.nuget.org/packages/MySqlBackup.Net.DevartExpress/
Add to Your Project
See the detailed guide:
How to Add This Library into Your Project
Basic Usage
Backup a Database
string constr = "server=localhost;user=root;pwd=1234;database=test1;convertzerodatetime=true;";
string filePath = @"C:\backup.sql";
using (var conn = new MySqlConnection(constr))
using (var cmd = conn.CreateCommand())
using (var mb = new MySqlBackup(cmd))
{
conn.Open();
mb.ExportToFile(filePath);
}
Restore a Database
string constr = "server=localhost;user=root;pwd=1234;database=test1;convertzerodatetime=true;";
string filePath = @"C:\backup.sql";
using (var conn = new MySqlConnection(constr))
using (var cmd = conn.CreateCommand())
using (var mb = new MySqlBackup(cmd))
{
conn.Open();
mb.ImportFromFile(filePath);
}
Why MySqlBackup.NET?
Unlike MySQL Workbench (developer-focused) or MySqlDump.exe (restricted in web environments), MySqlBackup.NET offers:
- End-User Simplicity: Preset parameters for a one-click backup experience.
- Web Compatibility: Runs seamlessly in ASP.NET, bypassing hosting restrictions on executables.
- Programmatic Control: Fine-tuned output handling within .NET.
Dependencies
MySqlBackup.NET requires one of these MySQL connectors:
Connector | Source | License | DLLs |
---|---|---|---|
MySqlConnector | MySqlConnector | MIT | MySqlConnector.dll |
MySql.Data | MySQL Connector/Net | GPL | MySql.Data.dll |
Devart Express | dotConnect for MySQL | Custom (FAQ) | Devart.Data.dll , Devart.Data.MySql.dll |
Configuration Tips
Unicode Support
- Always use the default character set of
utf8mb4
, orutf8
in older MySQL versions that do not supportutf8mb4
. - It is recommended to use
convertzerodatetime=true
in the connection string for compatibility when handling null datetime values.
Performance Benchmark
Compare MySqlBackup.NET to MySqlDump for a 3.5GB database (15M rows):
Task | Tool | Time | File Size |
---|---|---|---|
Backup | MySqlDump | ~2m 35s | 4.66 GB |
Backup | MySqlBackup.NET | ~7m 48s | 4.59 GB |
Restore | MySql.exe | ~8m 41s | - |
Restore | MySqlBackup.NET | ~9m 41s | - |
Full details: Performance Benchmark Wiki
Additional Tools
Backup All Databases
Export all databases to separate SQL files with this sub-project:
MySqlBackup_All_DB
License
MySqlBackup.NET is released under The Unlicense, making it free for any use.
Conclusion
MySqlBackup.NET empowers developers and end-users alike with a robust, .NET-native solution for MySQL database management. Whether for desktop apps, web services, or automated backups, it’s a versatile addition to your toolkit.
Explore more on GitHub!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- MySql.Data (>= 9.3.0)
-
.NETFramework 4.8
- MySql.Data (>= 9.3.0)
-
.NETStandard 2.0
- MySql.Data (>= 9.3.0)
- NETStandard.Library (>= 2.0.3)
-
.NETStandard 2.1
- MySql.Data (>= 9.3.0)
-
net8.0
- MySql.Data (>= 9.3.0)
-
net9.0
- MySql.Data (>= 9.3.0)
NuGet packages (15)
Showing the top 5 NuGet packages that depend on MySqlBackup.NET:
Package | Downloads |
---|---|
Nascorp.Library
Library to methods utilities |
|
ThrowawayDb.MySql
Dead simple integration tests with Sql server throwaway databases. |
|
FrontLookCoreDbBackUpLibrary
This package adds an asp.net core database backup library! Supports MsSql And MySql. |
|
Senparc.Ncf.Database.MySql.Backup
Senparc.Ncf.Database.MySql.Backup |
|
MyDapper
Dapper的操作帮助类 |
GitHub repositories (4)
Showing the top 4 popular GitHub repositories that depend on MySqlBackup.NET:
Repository | Stars |
---|---|
feiyit/FytSoaCms
NetCore2.2开发, Vs2017 数据Mysql
|
|
jaskie/PlayoutAutomation
Television broadcast automation system
|
|
logicpulse/logicPOS
Logicpulse's Open Source POS System
|
|
Zaid-Ajaj/ThrowawayDb
Dead simple integration tests with SQL Server or Postgres throwaway databases that are created on the fly, used briefly then disposed of automagically.
|
Version | Downloads | Last Updated |
---|---|---|
2.6.4 | 385 | 7/14/2025 |
2.6.3 | 141 | 7/13/2025 |
2.6.2 | 121 | 7/11/2025 |
2.6.1 | 232 | 7/4/2025 |
2.6.0 | 144 | 7/4/2025 |
2.3.9 | 9,473 | 3/12/2025 |
2.3.8 | 128,828 | 3/7/2023 |
2.3.7 | 104,961 | 10/18/2022 |
2.3.6.1 | 156,051 | 10/20/2021 |
2.3.6 | 4,547 | 10/17/2021 |
2.3.5.3 | 4,331 | 9/24/2021 |
2.3.5.2 | 1,517 | 9/23/2021 |
2.3.5.1 | 1,595 | 9/22/2021 |
2.3.4.2 | 9,358 | 7/30/2021 |
2.3.4.1 | 6,404 | 7/12/2021 |
2.3.4 | 90,607 | 3/10/2021 |
2.3.3.1 | 45,744 | 7/16/2020 |
2.3.1 | 326,178 | 8/23/2019 |
2.3.0.1 | 10,113 | 7/26/2019 |
2.3.0 | 5,260 | 6/24/2019 |
2.2.1 | 16,400 | 4/7/2019 |
2.2.0 | 1,996 | 4/7/2019 |
2.1.0 | 15,224 | 12/1/2018 |
2.0.12.1 | 10,958 | 8/28/2018 |
2.0.12 | 26,137 | 3/26/2018 |
2.0.11.1 | 6,047 | 2/7/2018 |
2.0.11 | 2,695 | 2/7/2018 |
2.0.10.1 | 5,376 | 12/2/2017 |
2.0.10 | 4,352 | 12/1/2017 |
2.0.9.5 | 54,475 | 11/19/2016 |
2.0.9.4 | 8,641 | 3/20/2016 |
2.0.9.3 | 9,644 | 1/9/2016 |
2.0.9.2 | 6,755 | 8/8/2015 |
2.0.9.1 | 3,023 | 7/24/2015 |
2.0.9 | 2,826 | 7/19/2015 |
2.0.8 | 37,412 | 2/24/2015 |
2.0.7.1 | 18,436 | 1/26/2015 |
2.0.6 | 3,202 | 11/21/2014 |
2.0.5.1 | 2,845 | 10/20/2014 |
2.0.5 | 2,534 | 10/20/2014 |
2.0.4 | 4,232 | 5/12/2014 |
2.0.3 | 2,650 | 5/11/2014 |
2.0.2.1 | 3,453 | 4/10/2014 |