MySql.Data 9.1.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
Licensing
Please refer to files README and LICENSE, available in the Connector/NET GitHub repository, and Legal Notices in documentation for further details.
Security
Oracle values the independent security research community and believes that responsible disclosure of security vulnerabilities helps us ensure the security and privacy of all our users. Please refer to the security guidelines document for additional information.
Contributing
We greatly appreciate feedback from our users, including bug reports and code contributions. Your input helps us improve, and we thank you for any issues you report or code you contribute. Please refer to the contributing guidelines document for additional information.
Additional Resources
- MySQL Connector/NET GitHub
- MySQL Connector/NET Developer Guide
- MySQL Connector/NET API
- MySQL NuGet
- MySQL Connector/NET and C#, Mono, .Net Forum
#connectors
channel on MySQL Community Slack (Sign-up required if you do not have an Oracle account.)- @MySQL on X.
- MySQL Blog.
- MySQL Connectors Blog archive.
- MySQL Newsletter.
- MySQL Bugs Tracking System.
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 |
---|---|
Serilog.Sinks.MySQL
Serilog event sink that writes to MySQL database
|
5 |
MySql.EntityFrameworkCore
MySql.EntityFrameworkCore for Entity Framework.
|
4 |
Serilog.Sinks.MySQL
Serilog event sink that writes to MySQL database
|
4 |
Hangfire.MySqlStorage
Hangfire MySql Storage
|
4 |
MySql.EntityFrameworkCore
MySql.EntityFrameworkCore adds support for Microsoft Entity Framework Core.
|
3 |
MySql.EntityFrameworkCore
MySQL Server database provider for Entity Framework Core.
|
3 |
Hangfire.MySqlStorage
Hangfire MySql Storage
|
3 |
Serilog.Sinks.MySQL
Serilog event sink that writes to MySQL database
|
3 |
MySql.EntityFrameworkCore
MySql.EntityFrameworkCore for Entity Framework.
|
3 |
.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.4)
- 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.4)
- 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.4)
- 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.4)
- 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.2.0 | 0 | 01/21/2025 |
9.1.0 | 3 | 11/26/2024 |
9.0.0 | 4 | 10/09/2024 |
8.4.0 | 5 | 10/04/2024 |
8.3.0 | 5 | 06/04/2024 |
8.2.0 | 7 | 03/02/2024 |
8.1.0 | 3 | 10/04/2024 |
8.0.33 | 3 | 10/09/2024 |
8.0.32.1 | 3 | 10/04/2024 |
8.0.32 | 3 | 10/02/2024 |
8.0.31 | 2 | 10/09/2024 |
8.0.30 | 3 | 09/19/2022 |
8.0.29 | 3 | 11/30/2022 |
8.0.28 | 3 | 10/09/2024 |
8.0.27 | 3 | 10/09/2024 |
8.0.26 | 5 | 02/09/2022 |
8.0.25 | 2 | 10/09/2024 |
8.0.24 | 4 | 10/09/2024 |
8.0.23 | 2 | 10/09/2024 |
8.0.22 | 3 | 10/09/2024 |
8.0.21 | 2 | 10/09/2024 |
8.0.20 | 2 | 10/09/2024 |
8.0.19 | 3 | 09/30/2024 |
8.0.18 | 2 | 10/09/2024 |
8.0.17 | 3 | 10/02/2024 |
8.0.16 | 3 | 10/09/2024 |
8.0.15 | 2 | 10/09/2024 |
8.0.14 | 3 | 10/05/2024 |
8.0.13 | 3 | 10/01/2024 |
8.0.12 | 3 | 10/04/2024 |
8.0.11 | 2 | 10/09/2024 |
6.10.9 | 3 | 10/09/2024 |
6.10.7 | 3 | 10/05/2024 |
6.9.12 | 3 | 10/02/2024 |
6.8.8 | 3 | 10/09/2024 |
6.7.9 | 3 | 10/09/2024 |