MySqlConnector 2.3.7
About
MySqlConnector is a C# ADO.NET driver 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");
// ...
}
ASP.NET
For ASP.NET, use the MySqlConnector.DependencyInjection package to integrate with dependency injection and logging.
var builder = WebApplication.CreateBuilder(args);
// use AddMySqlDataSource to configure MySqlConnector
builder.Services.AddMySqlDataSource(builder.Configuration.GetConnectionString("Default"));
var app = builder.Build();
// use dependency injection to get a MySqlConnection in minimal APIs or in controllers
app.MapGet("/", async (MySqlConnection connection) =>
{
// open and use the connection here
await connection.OpenAsync();
await using var command = connection.CreateCommand();
command.CommandText = "SELECT name FROM users LIMIT 1";
return "Hello World: " + await command.ExecuteScalarAsync();
});
app.Run();
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 ofDbConnection
)MySqlCommand
(implementation ofDbCommand
)MySqlDataReader
(implementation ofDbDataReader
)MySqlBulkCopy
MySqlBulkLoader
MySqlConnectionStringBuilder
MySqlConnectorFactory
MySqlDataAdapter
MySqlException
MySqlTransaction
(implementation ofDbTransaction
)
Related Packages
- Dependency Injection: MySqlConnector.DependencyInjection
- Entity Framework Core: Pomelo.EntityFrameworkCore.MySql
Feedback
MySqlConnector is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Showing the top 20 packages that depend on MySqlConnector.
Packages | Downloads |
---|---|
Pomelo.EntityFrameworkCore.MySql
Pomelo's MySQL database provider for Entity Framework Core.
|
20 |
Pomelo.EntityFrameworkCore.MySql
Pomelo's MySQL database provider for Entity Framework Core.
|
7 |
Pomelo.EntityFrameworkCore.MySql
Package Description
|
7 |
Pomelo.EntityFrameworkCore.MySql
Pomelo's MySQL database provider for Entity Framework Core.
|
6 |
Pomelo.EntityFrameworkCore.MySql
MySQL provider for Entity Framework Core
|
6 |
Pomelo.EntityFrameworkCore.MySql
Package Description
|
6 |
Pomelo.EntityFrameworkCore.MySql
Pomelo's MySQL database provider for Entity Framework Core.
|
5 |
Pomelo.EntityFrameworkCore.MySql
MySQL provider for Entity Framework Core
|
5 |
https://mysqlconnector.net/overview/version-history/
.NET Framework 4.6.2
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
.NET Standard 2.1
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
.NET Standard 2.0
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
.NET 8.0
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
.NET 7.0
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
.NET 6.0
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
.NET Framework 4.8
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
.NET Framework 4.7.1
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
Version | Downloads | Last updated |
---|---|---|
2.4.0 | 3 | 11/13/2024 |
2.4.0-beta.2 | 2 | 10/31/2024 |
2.4.0-beta.1 | 1 | 10/31/2024 |
2.3.7 | 21 | 04/29/2024 |
2.3.6 | 21 | 04/29/2024 |
2.3.5 | 5 | 01/24/2024 |
2.3.4 | 6 | 01/19/2024 |
2.3.3 | 5 | 01/19/2024 |
2.3.2 | 4 | 01/21/2024 |
2.3.1 | 5 | 01/19/2024 |
2.3.0 | 6 | 01/19/2024 |
2.2.7 | 3 | 01/20/2024 |
2.2.6 | 2 | 01/21/2024 |
2.2.5 | 1 | 01/21/2024 |
2.2.4 | 1 | 01/20/2024 |
2.2.3 | 5 | 01/21/2024 |
2.2.2 | 2 | 01/19/2024 |
2.2.1 | 3 | 01/19/2024 |
2.2.0 | 1 | 01/21/2024 |
2.1.13 | 2 | 01/21/2024 |
2.1.12 | 5 | 01/21/2024 |
2.1.11 | 4 | 02/13/2024 |
2.1.10 | 3 | 01/21/2024 |
2.1.9 | 4 | 01/21/2024 |
2.1.8 | 3 | 01/21/2024 |
2.1.7 | 3 | 01/19/2024 |
2.1.6 | 3 | 01/21/2024 |
2.1.5 | 2 | 01/21/2024 |
2.1.4 | 3 | 01/21/2024 |
2.1.3 | 4 | 01/21/2024 |
2.1.2 | 6 | 01/19/2024 |
2.1.1 | 1 | 01/21/2024 |
2.1.0 | 5 | 01/21/2024 |
2.0.0 | 5 | 01/21/2024 |
1.3.14 | 5 | 01/21/2024 |
1.3.13 | 6 | 01/21/2024 |
1.3.12 | 3 | 01/21/2024 |
1.3.11 | 4 | 01/21/2024 |
1.3.10 | 8 | 08/15/2023 |
1.3.9 | 2 | 01/20/2024 |
1.3.8 | 2 | 01/21/2024 |
1.3.7 | 4 | 01/21/2024 |
1.3.6 | 4 | 01/19/2024 |
1.3.5 | 3 | 01/21/2024 |
1.3.4 | 2 | 01/21/2024 |
1.3.3 | 3 | 01/20/2024 |
1.3.2 | 3 | 01/21/2024 |
1.3.1 | 4 | 01/21/2024 |
1.3.0 | 1 | 01/20/2024 |
1.2.1 | 3 | 01/19/2024 |
1.2.0 | 3 | 01/21/2024 |
1.1.0 | 5 | 01/21/2024 |
1.0.1 | 2 | 01/19/2024 |
1.0.0 | 5 | 02/13/2024 |
0.69.10 | 4 | 01/19/2024 |
0.69.9 | 5 | 01/21/2024 |
0.69.8 | 4 | 01/19/2024 |
0.69.7 | 3 | 01/19/2024 |
0.69.6 | 4 | 01/19/2024 |
0.69.5 | 2 | 01/21/2024 |
0.69.4 | 4 | 01/21/2024 |
0.69.3 | 4 | 01/21/2024 |
0.69.2 | 3 | 01/21/2024 |
0.69.1 | 4 | 01/21/2024 |
0.69.0 | 5 | 01/19/2024 |
0.68.1 | 5 | 01/21/2024 |
0.68.0 | 5 | 01/21/2024 |
0.67.0 | 3 | 01/21/2024 |
0.66.0 | 2 | 01/21/2024 |
0.65.0 | 3 | 01/20/2024 |
0.64.2 | 4 | 01/20/2024 |
0.64.1 | 4 | 01/21/2024 |
0.64.0 | 8 | 01/20/2024 |
0.63.2 | 7 | 01/20/2024 |
0.63.1 | 2 | 01/21/2024 |
0.63.0 | 5 | 01/21/2024 |
0.62.0 | 7 | 01/19/2024 |
0.61.0 | 3 | 01/21/2024 |
0.60.4 | 6 | 01/20/2024 |
0.60.3 | 4 | 01/21/2024 |
0.60.2 | 3 | 01/21/2024 |
0.60.1 | 2 | 01/20/2024 |
0.60.0 | 3 | 02/13/2024 |
0.59.2 | 2 | 01/21/2024 |
0.59.1 | 2 | 01/20/2024 |
0.59.0 | 4 | 01/21/2024 |
0.58.0 | 5 | 01/20/2024 |
0.57.0 | 5 | 01/21/2024 |
0.56.0 | 3 | 01/21/2024 |
0.55.0 | 4 | 01/21/2024 |
0.54.0 | 4 | 01/20/2024 |
0.53.0 | 3 | 01/20/2024 |
0.52.0 | 3 | 01/20/2024 |
0.51.1 | 6 | 01/20/2024 |
0.51.0 | 2 | 01/20/2024 |
0.50.0 | 3 | 01/20/2024 |
0.49.3 | 4 | 01/21/2024 |
0.49.2 | 3 | 01/20/2024 |
0.49.0 | 7 | 01/19/2024 |
0.48.2 | 4 | 01/21/2024 |
0.48.1 | 2 | 01/21/2024 |
0.48.0 | 2 | 01/20/2024 |
0.47.1 | 3 | 01/19/2024 |
0.47.0 | 3 | 01/20/2024 |
0.46.2 | 6 | 01/19/2024 |
0.46.1 | 3 | 01/19/2024 |
0.46.0 | 5 | 01/21/2024 |
0.45.1 | 3 | 01/21/2024 |
0.45.0 | 4 | 01/20/2024 |
0.44.1 | 4 | 01/21/2024 |
0.44.0 | 4 | 01/21/2024 |
0.43.0 | 5 | 01/20/2024 |
0.42.3 | 4 | 01/20/2024 |
0.42.2 | 5 | 01/21/2024 |
0.42.1 | 4 | 01/21/2024 |
0.42.0 | 5 | 01/21/2024 |
0.41.0 | 5 | 01/21/2024 |
0.40.4 | 6 | 01/19/2024 |
0.40.3 | 5 | 01/19/2024 |
0.40.2 | 3 | 01/21/2024 |
0.36.0 | 3 | 01/21/2024 |
0.35.0 | 8 | 01/19/2024 |
0.32.0 | 4 | 01/21/2024 |
0.30.0 | 2 | 01/20/2024 |
0.29.4 | 6 | 01/19/2024 |
0.29.2 | 6 | 01/19/2024 |
0.26.5 | 6 | 01/19/2024 |
0.26.4 | 3 | 01/21/2024 |
0.26.3 | 4 | 01/19/2024 |
0.26.2 | 2 | 01/20/2024 |
0.26.1 | 2 | 01/21/2024 |
0.26.0 | 2 | 01/21/2024 |
0.25.1 | 3 | 01/21/2024 |
0.25.0 | 1 | 01/21/2024 |
0.20.0 | 3 | 01/19/2024 |
0.19.5 | 6 | 01/21/2024 |
0.19.4 | 4 | 01/21/2024 |
0.19.3 | 5 | 01/21/2024 |
0.19.2 | 4 | 01/21/2024 |
0.16.2 | 2 | 01/21/2024 |
0.10.0 | 2 | 01/21/2024 |
0.9.0 | 4 | 01/20/2024 |
0.8.0 | 5 | 01/21/2024 |
0.7.4 | 3 | 01/21/2024 |
0.7.3 | 2 | 01/20/2024 |
0.7.2 | 3 | 01/21/2024 |
0.7.1 | 3 | 01/21/2024 |
0.7.0 | 5 | 01/20/2024 |
0.6.2 | 2 | 01/21/2024 |
0.6.1 | 5 | 01/21/2024 |
0.6.0 | 4 | 01/21/2024 |
0.5.0 | 4 | 01/21/2024 |
0.4.0 | 5 | 01/21/2024 |
0.3.0 | 6 | 01/19/2024 |
0.2.1 | 5 | 01/21/2024 |
0.2.0 | 5 | 01/21/2024 |
0.1.0 | 2 | 01/21/2024 |