MySql.Data 9.0.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
#connectors
channel 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.
Showing the top 20 packages that depend on MySql.Data.
Packages | Downloads |
---|---|
FreeSql.Provider.MySql
FreeSql 数据库实现,基于 MySql 5.6
|
24 |
FreeSql.Provider.MySql
FreeSql 数据库实现,基于 MySql 5.6
|
26 |
FreeSql.Provider.MySql
FreeSql 数据库实现,基于 MySql 5.6,Ado.Net 驱动是 MySql.Data(Oracle官方)
|
24 |
FreeSql.Provider.MySql
FreeSql 数据库实现,基于 MySql 5.6,Ado.Net 驱动是 MySql.Data(Oracle官方)
|
25 |
Hangfire.MySqlStorage
Hangfire MySql Storage
|
23 |
Hangfire.MySqlStorage
Hangfire MySql Storage
|
24 |
Hangfire.MySqlStorage
Hangfire MySql Storage
|
25 |
Hangfire.MySqlStorage
Hangfire MySql Storage
|
26 |
Hangfire.MySqlStorage
Hangfire MySql Storage
|
28 |
MySql.Data.Entity
Entity Framework 6.0 supported
|
27 |
MySql.Data.Entity
MySql.Data.Entity 6.9.9
|
24 |
MySql.Data.EntityFrameworkCore
MySql.Data.EntityFrameworkCore for Entity Framework.
|
24 |
MySql.Data.EntityFrameworkCore
MySql.Data.EntityFrameworkCore for Entity Framework.
|
26 |
MySql.Data.EntityFrameworkCore
MySql.Data.EntityFrameworkCore for Entity Framework.
|
27 |
Serilog.Sinks.MySQL
Serilog event sink that writes to MySQL database
|
27 |
sqlSugarCore
.Net Core 2.0 SqlSugar ORM ,High-performance, lightweight https://github.com/sunkaixuan/SqlSugar
|
23 |
Review ReleaseNotes.txt for details.
.NET Framework 4.6.2
- BouncyCastle.Cryptography (>= 2.3.1)
- ZstdSharp.Port (>= 0.8.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Buffers (>= 4.5.1)
- K4os.Compression.LZ4.Streams (>= 1.3.8)
- Google.Protobuf (>= 3.26.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
.NET Standard 2.0
- System.Runtime.Loader (>= 4.3.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Buffers (>= 4.5.1)
- K4os.Compression.LZ4.Streams (>= 1.3.8)
- System.Security.Permissions (>= 8.0.0)
- Google.Protobuf (>= 3.26.1)
- BouncyCastle.Cryptography (>= 2.3.1)
- System.Text.Encoding.CodePages (>= 8.0.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.Text.Json (>= 8.0.3)
- ZstdSharp.Port (>= 0.8.0)
.NET 8.0
- ZstdSharp.Port (>= 0.8.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.Text.Json (>= 8.0.3)
- System.Text.Encoding.CodePages (>= 8.0.0)
- System.Security.Permissions (>= 8.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Runtime.Loader (>= 4.3.0)
- K4os.Compression.LZ4.Streams (>= 1.3.8)
- System.Buffers (>= 4.5.1)
- Google.Protobuf (>= 3.26.1)
- BouncyCastle.Cryptography (>= 2.3.1)
.NET Standard 2.1
- ZstdSharp.Port (>= 0.8.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.Text.Json (>= 8.0.3)
- System.Text.Encoding.CodePages (>= 8.0.0)
- System.Security.Permissions (>= 8.0.0)
- System.Runtime.Loader (>= 4.3.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Buffers (>= 4.5.1)
- K4os.Compression.LZ4.Streams (>= 1.3.8)
- Google.Protobuf (>= 3.26.1)
- BouncyCastle.Cryptography (>= 2.3.1)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
.NET Framework 4.8
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Buffers (>= 4.5.1)
- K4os.Compression.LZ4.Streams (>= 1.3.8)
- Google.Protobuf (>= 3.26.1)
- BouncyCastle.Cryptography (>= 2.3.1)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
- ZstdSharp.Port (>= 0.8.0)
.NET 6.0
- BouncyCastle.Cryptography (>= 2.3.1)
- ZstdSharp.Port (>= 0.8.0)
- System.Text.Json (>= 8.0.3)
- System.Text.Encoding.CodePages (>= 8.0.0)
- System.Security.Permissions (>= 8.0.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Buffers (>= 4.5.1)
- K4os.Compression.LZ4.Streams (>= 1.3.8)
- Google.Protobuf (>= 3.26.1)
- System.Runtime.Loader (>= 4.3.0)
Version | Downloads | Last updated |
---|---|---|
9.3.0 | 10 | 04/25/2025 |
9.2.0 | 12 | 01/29/2025 |
9.1.0 | 13 | 11/01/2024 |
9.0.0 | 13 | 12/08/2024 |
8.4.0 | 37 | 05/11/2024 |
8.3.0 | 23 | 03/26/2024 |
8.2.0 | 20 | 12/13/2023 |
8.1.0 | 22 | 10/25/2023 |
8.0.33 | 21 | 05/06/2023 |
8.0.32.1 | 53 | 04/13/2023 |
8.0.32 | 20 | 06/13/2023 |
8.0.31 | 16 | 10/28/2022 |
8.0.30 | 23 | 12/14/2022 |
8.0.28 | 23 | 06/06/2022 |
8.0.24 | 19 | 06/06/2022 |
8.0.17 | 14 | 05/01/2024 |
8.0.13 | 15 | 05/30/2024 |
8.0.12 | 16 | 05/30/2024 |
6.9.8 | 10 | 11/25/2024 |
6.9.5 | 20 | 08/01/2022 |
6.9.3 | 14 | 11/25/2024 |