MySql.Data
8.3.0
Prefix Reserved
See the version list below for details.
dotnet add package MySql.Data --version 8.3.0
NuGet\Install-Package MySql.Data -Version 8.3.0
<PackageReference Include="MySql.Data" Version="8.3.0" />
<PackageVersion Include="MySql.Data" Version="8.3.0" />
<PackageReference Include="MySql.Data" />
paket add MySql.Data --version 8.3.0
#r "nuget: MySql.Data, 8.3.0"
#:package MySql.Data@8.3.0
#addin nuget:?package=MySql.Data&version=8.3.0
#tool nuget:?package=MySql.Data&version=8.3.0
About
MySQL provides connectivity for client applications developed in .NET compatible programming languages with MySQL Connector/NET through a series of packages.
MySql.Data is the core package of Connector/NET. It is compatible with .NET Framework 4.6+ and .NET 6.0+ and provides classic MySQL protocol and MySQL X DevAPI capabilities.
More information at MySQL Connector/NET documentation.
How to use
MySql.Data.MySqlClient.MySqlConnection myConnection;
string myConnectionString;
//set the correct values for your server, user, password and database name
myConnectionString = "server=127.0.0.1;uid=root;pwd=12345;database=test";
try
{
myConnection = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);
//open a connection
myConnection.Open();
// create a MySQL command and set the SQL statement with parameters
MySqlCommand myCommand = new MySqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandText = @"SELECT * FROM clients WHERE client_id = @clientId;";
myCommand.Parameters.AddWithValue("@clientId", clientId);
// execute the command and read the results
using var myReader = myCommand.ExecuteReader()
{
while (myReader.Read())
{
var id = myReader.GetInt32("client_id");
var name = myReader.GetString("client_name");
// ...
}
}
myConnection.Close();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message);
}
Related Packages
- Entity Framework Core: MySql.EntityFrameworkCore
- Entity Framework: MySql.Data.EntityFramework
- Web: MySql.Web
- OpenTelemetry: MySql.Data.OpenTelemetry
Contributing
There are a few ways to contribute to the Connector/NET code. Please refer to the contributing guidelines for additional information.
Additional Resources
- MySQL
- MySQL Connector/NET GitHub
- MySQL Connector/NET API
- MySQL Connector/NET Discussion Forum
- MySQL Public Bug Tracker
#connectorschannel in MySQL Community Slack (Sign-up required when not using an Oracle account)- For more information about this and other MySQL products, please visit MySQL Contact & Questions.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 was computed. 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
- BouncyCastle.Cryptography (>= 2.2.1)
- Google.Protobuf (>= 3.25.1)
- K4os.Compression.LZ4.Streams (>= 1.3.5)
- System.Buffers (>= 4.5.1)
- System.Configuration.ConfigurationManager (>= 4.4.1)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- ZstdSharp.Port (>= 0.7.1)
-
.NETFramework 4.8
- BouncyCastle.Cryptography (>= 2.2.1)
- Google.Protobuf (>= 3.25.1)
- K4os.Compression.LZ4.Streams (>= 1.3.5)
- System.Buffers (>= 4.5.1)
- System.Configuration.ConfigurationManager (>= 4.4.1)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- ZstdSharp.Port (>= 0.7.1)
-
.NETStandard 2.0
- BouncyCastle.Cryptography (>= 2.2.1)
- Google.Protobuf (>= 3.25.1)
- K4os.Compression.LZ4.Streams (>= 1.3.5)
- System.Buffers (>= 4.5.1)
- System.Configuration.ConfigurationManager (>= 4.4.1)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Runtime.Loader (>= 4.3.0)
- System.Security.Permissions (>= 4.7.0)
- System.Text.Encoding.CodePages (>= 4.4.0)
- System.Text.Json (>= 7.0.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- ZstdSharp.Port (>= 0.7.1)
-
.NETStandard 2.1
- BouncyCastle.Cryptography (>= 2.2.1)
- Google.Protobuf (>= 3.25.1)
- K4os.Compression.LZ4.Streams (>= 1.3.5)
- System.Buffers (>= 4.5.1)
- System.Configuration.ConfigurationManager (>= 4.4.1)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Runtime.Loader (>= 4.3.0)
- System.Security.Permissions (>= 4.7.0)
- System.Text.Encoding.CodePages (>= 4.4.0)
- System.Text.Json (>= 7.0.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- ZstdSharp.Port (>= 0.7.1)
-
net6.0
- BouncyCastle.Cryptography (>= 2.2.1)
- Google.Protobuf (>= 3.25.1)
- K4os.Compression.LZ4.Streams (>= 1.3.5)
- System.Buffers (>= 4.5.1)
- System.Configuration.ConfigurationManager (>= 4.4.1)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Runtime.Loader (>= 4.3.0)
- System.Security.Permissions (>= 4.7.0)
- System.Text.Encoding.CodePages (>= 4.4.0)
- System.Text.Json (>= 7.0.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- ZstdSharp.Port (>= 0.7.1)
-
net7.0
- BouncyCastle.Cryptography (>= 2.2.1)
- Google.Protobuf (>= 3.25.1)
- K4os.Compression.LZ4.Streams (>= 1.3.5)
- System.Buffers (>= 4.5.1)
- System.Configuration.ConfigurationManager (>= 4.4.1)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Runtime.Loader (>= 4.3.0)
- System.Security.Permissions (>= 4.7.0)
- System.Text.Encoding.CodePages (>= 4.4.0)
- System.Text.Json (>= 7.0.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- ZstdSharp.Port (>= 0.7.1)
-
net8.0
- BouncyCastle.Cryptography (>= 2.2.1)
- Google.Protobuf (>= 3.25.1)
- K4os.Compression.LZ4.Streams (>= 1.3.5)
- System.Buffers (>= 4.5.1)
- System.Configuration.ConfigurationManager (>= 4.4.1)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Runtime.Loader (>= 4.3.0)
- System.Security.Permissions (>= 4.7.0)
- System.Text.Encoding.CodePages (>= 4.4.0)
- System.Text.Json (>= 7.0.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- ZstdSharp.Port (>= 0.7.1)
NuGet packages (2.0K)
Showing the top 5 NuGet packages that depend on MySql.Data:
| Package | Downloads |
|---|---|
|
MySql.EntityFrameworkCore
MySql.EntityFrameworkCore adds support for Microsoft Entity Framework Core. |
|
|
MySql.Data.EntityFrameworkCore
MySql.Data.EntityFrameworkCore for Entity Framework. |
|
|
MySql.Data.EntityFramework
MySql.Data.EntityFramework |
|
|
OpenTelemetry.Instrumentation.MySqlData
OpenTelemetry instrumentation for MySql.Data |
|
|
Dos.ORM
Dos.ORM于2009年发布、2015年开源,该组件已在大量成熟项目中应用。开源低代码平台 - Microi吾码:https://microi.net |
GitHub repositories (180)
Showing the top 20 popular GitHub repositories that depend on MySql.Data:
| Repository | Stars |
|---|---|
|
mRemoteNG/mRemoteNG
mRemoteNG is the next generation of mRemote, open source, tabbed, multi-protocol, remote connections manager.
|
|
|
dotnet/orleans
Cloud Native application framework for .NET
|
|
|
1Remote/1Remote
One Remote Access Manager to Rule Them All
|
|
|
DotNetNext/SqlSugar
.Net aot ORM SqlServer ORM Mongodb ORM MySql 瀚高 Postgresql ORM DB2 Hana 高斯 Duckdb C# VB.NET Sqlite ORM Oracle ORM Mysql Orm 虚谷数据库 达梦 ORM 人大金仓 ORM 神通ORM C# ORM , C# ORM .NET ORM NET9 ORM .NET8 ORM ClickHouse ORM QuestDb ,TDengine ORM,OceanBase ORM,GaussDB ORM,Tidb ORM Object/Relational Mapping
|
|
|
ServiceStack/ServiceStack
Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all
|
|
|
dotnetcore/FreeSql
.NET aot orm, VB.NET/C# orm, Mysql/PostgreSQL/SqlServer/Oracle orm, Sqlite/Firebird/Clickhouse/DuckDB orm, 达梦/金仓/虚谷/翰高/高斯 orm, 神通 orm, 南大通用 orm, 国产 orm, TDengine orm, QuestDB orm, MsAccess orm.
|
|
|
fluentmigrator/fluentmigrator
Fluent migrations framework for .NET
|
|
|
sqlkata/querybuilder
SQL query builder, written in c#, helps you build complex queries easily, supports SqlServer, MySql, PostgreSql, Oracle, Sqlite and Firebird
|
|
|
linq2db/linq2db
Linq to database provider.
|
|
|
ONLYOFFICE/CommunityServer
Free open source office suite with business productivity tools: document and project management, CRM, mail aggregator.
|
|
|
SciSharp/BotSharp
AI Multi-Agent Framework in .NET
|
|
|
GavinYellow/SharpSCADA
C# SCADA
|
|
|
jbogard/Respawn
Intelligent database cleaner for integration tests
|
|
|
Pryaxis/TShock
☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
|
|
|
ArgoZhang/BootstrapAdmin
BootstrapAdmin - Free Premium Admin control Panel Based On Bootstrap 4.x
|
|
|
hitchao/Jvedio
Jvedio 是本地视频管理软件,支持扫描本地视频并导入软件,建立视频库, 提取出视频的 唯一识别码,自动分类视频, 添加标签管理视频,使用人工智能识别演员,支持翻译信息, 基于 FFmpeg 截取视频图片,Window 桌面端流畅美观的应用软件
|
|
|
OrchardCMS/Orchard
Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform. Check out the next generation of this software built on ASP.NET Core: https://github.com/OrchardCMS/OrchardCore
|
|
|
oqtane/oqtane.framework
Oqtane is an open-source developer productivity platform for building modern .NET applications and websites that run on Web, Desktop and Mobile.
|
|
|
nhibernate/nhibernate-core
NHibernate Object Relational Mapper
|
|
|
CollaboratingPlatypus/PetaPoco
Official PetaPoco, A tiny ORM-ish thing for your POCO's
|
| Version | Downloads | Last Updated |
|---|---|---|
| 26.7.0 | 516,802 | 7/29/2026 |
| 9.7.0 | 1,665,760 | 4/22/2026 |
| 9.6.0 | 1,595,628 | 1/21/2026 |
| 9.5.0 | 1,458,480 | 10/22/2025 |
| 9.4.0 | 1,768,805 | 7/22/2025 |
| 9.3.0 | 2,554,848 | 4/15/2025 |
| 9.2.0 | 2,830,048 | 1/21/2025 |
| 9.1.0 | 5,270,145 | 10/15/2024 |
| 9.0.0 | 4,660,302 | 7/1/2024 |
| 8.4.0 | 3,956,264 | 4/30/2024 |
| 8.3.0 | 3,966,210 | 1/16/2024 |
| 8.2.0 | 2,306,813 | 10/25/2023 |
| 8.1.0 | 3,232,692 | 7/18/2023 |
| 8.0.33 | 4,489,432 | 4/18/2023 |
| 8.0.32.1 | 1,972,987 | 3/8/2023 |
| 8.0.32 | 4,543,340 | 1/17/2023 |
| 8.0.31 | 5,632,718 | 10/11/2022 |
| 8.0.30 | 6,488,114 | 7/26/2022 |
| 8.0.29 | 5,658,636 | 4/26/2022 |
| 8.0.28 | 4,715,421 | 1/21/2022 |
Review ReleaseNotes.txt for details.