Skip to main content
.NETFramework4.5.NETFramework4.6.1.NETFramework4.7.1.NETStandard1.3.NETCoreApp2.1.NETCoreApp3.1

A truly async MySQL ADO.NET provider, supporting MySQL Server, MariaDB, Percona Server, Amazon Aurora, Azure Database for MySQL and more.

Published
Jun 16, 2021
5y ago
Total Downloads
261.9M
261,855,508

Install

dotnet add package MySqlConnector --version 1.3.10
ProductVersions
.NET
net5.0
.NET Standard
netstandard1.3netstandard2.0netstandard2.1
Other
.NETCoreApp2.1.NETCoreApp3.1.NETFramework4.5.NETFramework4.6.1.NETFramework4.7.1

README

About

MySqlConnector is an ADO.NET data provider for MySQL, MariaDB, Amazon Aurora, Azure Database for MySQL and other MySQL-compatible databases.

More documentation is available at the MySqlConnector website.

How to Use

// set these values correctly for your database server
var builder = new MySqlConnectionStringBuilder
{
	Server = "your-server",
	UserID = "database-user",
	Password = "P@ssw0rd!",
	Database = "database-name",
};

// open a connection asynchronously
using var connection = new MySqlConnection(builder.ConnectionString);
await connection.OpenAsync();

// create a DB command and set the SQL statement with parameters
using var command = connection.CreateCommand();
command.CommandText = @"SELECT * FROM orders WHERE order_id = @OrderId;";
command.Parameters.AddWithValue("@OrderId", orderId);

// execute the command and read the results
using var reader = await command.ExecuteReaderAsync();
while (reader.Read())
{
	var id = reader.GetInt32("order_id");
	var date = reader.GetDateTime("order_date");
	// ...
}

Key Features

  • Full support for async I/O
  • High performance
  • Supports. NET Framework, .NET Core, and .NET 5.0+

Main Types

The main types provided by this library are:

  • MySqlConnection (implementation of DbConnection)
  • MySqlCommand (implementation of DbCommand)
  • MySqlDataReader (implementation of DbDataReader)
  • MySqlBulkCopy
  • MySqlBulkLoader
  • MySqlConnectionStringBuilder
  • MySqlConnectorFactory
  • MySqlDataAdapter
  • MySqlException
  • MySqlTransaction (implementation of DbTransaction)

Related Packages

Feedback

MySqlConnector is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Changes from Previous Version

v1.3.9v1.3.10
Added Frameworks
.NETFramework4.5.NETFramework4.6.1.NETFramework4.7.1.NETStandard1.3.NETCoreApp2.1.NETCoreApp3.1net5.0.NETStandard2.0.NETStandard2.1
Added Dependencies
System.Buffers(.NETFramework4.5)
System.Memory(.NETFramework4.5)
System.Buffers(.NETFramework4.6.1)
System.Memory(.NETFramework4.6.1)
System.Buffers(.NETFramework4.7.1)
System.Memory(.NETFramework4.7.1)
NETStandard.Library(.NETStandard1.3)
System.Buffers(.NETStandard1.3)
System.Data.Common(.NETStandard1.3)
System.Memory(.NETStandard1.3)
System.Net.NameResolution(.NETStandard1.3)
+6 more
Deprecation Removed
Deprecation notice was removed in this version.

Adoption Assessment

Services requiring reliable async behavior and modern .NET compatibility with MySQL-family databases.

Databases Guide
Compatibility metadata lists 9 target frameworks; confirm the exact target used by your application.The published metadata declares 21 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.
Editorial Note: Fully managed async-first MySQL connector widely used for MySQL and MariaDB workloads. Trade-off: Engine-version and server-configuration differences still require integration testing in realistic environments.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.