MySqlConnector


MySqlConnector: High Performance MySQL Library for .NET

  • Asynchronous: True asynchronous I/O for maximum throughput
  • Fast: Optimized for speed and low memory usage
  • Reliable: Fixes dozens of open bugs in Oracle’s Connector/NET; passes all ADO.NET Specification Tests
  • Leading Edge: First MySQL library to support .NET Core; uses the latest .NET features
  • Open: MIT license; development happens on GitHub with publicly visible roadmaps, issues, and PRs

About

MySqlConnector is an ADO.NET data provider for MySQL Server, MariaDB, Percona Server, Amazon Aurora, Azure Database for MySQL, Google Cloud SQL for MySQL and more. It provides implementations of DbConnection, DbCommand, DbDataReader, DbTransaction — the classes needed to query and update databases from managed code.

Getting Started

Install MySqlConnector from NuGet: dotnet add package MySqlConnector

Connecting to your database is simple:

using (var connection = new MySqlConnection("Server=myserver;User ID=mylogin;Password=mypass;Database=mydatabase"))
{
    connection.Open();

    using (var command = new MySqlCommand("SELECT field FROM table;", connection))
    using (var reader = command.ExecuteReader())
        while (reader.Read())
            Console.WriteLine(reader.GetString(0));
}

For more information, see how to install and a basic example of using the API. Many ORMs are supported.

Performance

MySqlConnector outperforms Connector/NET (MySql.Data) on benchmarks:

Benchmark 1 Benchmark 2

(Client: MySqlConnector 0.44.0, Windows 10 x64; Server: MySQL Server 5.6.21, Unix)

Why use MySqlConnector over Oracle’s Connector/NET?

MySqlConnector is a clean-room reimplementation of the MySQL Protocol and is not based on Oracle’s Connector/NET.

MySqlConnectorOracle’s Connector/NETMySqlConnector Advantage
AsyncFully asynchronous I/OAsync calls map to synchronous I/OUses fewer thread pool threads; higher throughput
DevelopmentOpen and Collaborative Development on GitHubClosed Development Roadmap. Code is viewable on GitHub, some issues addressed in forumsGet involved! View our roadmap, discuss issues, contribute pull requests
LicenseThe MIT LicenseGPLv2 with FOSS Exception; or commercial licenseMore Permissive