MySql.Data 9.4.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 8.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);
    }

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

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
27
FreeSql.Provider.MySql
FreeSql 数据库实现,基于 MySql 5.6
28
FreeSql.Provider.MySql
FreeSql 数据库实现,基于 MySql 5.6
29
Hangfire.MySqlStorage
Hangfire MySql Storage
27
Hangfire.MySqlStorage
Hangfire MySql Storage
28
Hangfire.MySqlStorage
Hangfire MySql Storage
29
Hangfire.MySqlStorage
Hangfire MySql Storage
31
MySql.Data.Entity
Entity Framework 6.0 supported
30
MySql.Data.EntityFramework
MySql.Data.EntityFramework
27
MySql.Data.EntityFramework
MySql.Data.EntityFramework
28
MySql.Data.EntityFramework
MySql.Data.EntityFramework
29
MySql.Data.EntityFramework
MySql.Data.EntityFramework
30
MySql.Data.EntityFrameworkCore
MySql.Data.EntityFrameworkCore for Entity Framework.
29
MySql.Data.EntityFrameworkCore
MySql.Data.EntityFrameworkCore for Entity Framework.
30
Serilog.Sinks.MySQL
Serilog event sink that writes to MySQL database
32
sqlSugarCore
.Net Core 2.0 SqlSugar ORM ,High-performance, lightweight https://github.com/sunkaixuan/SqlSugar
27

Review ReleaseNotes.txt for details.

.NET Framework 4.6.2

.NET Standard 2.0

.NET 9.0

.NET Standard 2.1

.NET Framework 4.8

.NET 8.0

Version Downloads Last updated
9.4.0 1 07/26/2025
9.3.0 18 04/25/2025
9.2.0 15 01/29/2025
9.1.0 16 11/01/2024
9.0.0 16 12/08/2024
8.4.0 43 05/11/2024
8.3.0 26 03/26/2024
8.2.0 24 12/13/2023
8.1.0 24 10/25/2023
8.0.33 23 05/06/2023
8.0.32.1 55 04/13/2023
8.0.32 23 06/13/2023
8.0.31 19 10/28/2022
8.0.30 25 12/14/2022
8.0.28 27 06/06/2022
8.0.24 22 06/06/2022
8.0.17 17 05/01/2024
8.0.13 18 05/30/2024
8.0.12 21 05/30/2024
6.9.8 14 11/25/2024
6.9.5 22 08/01/2022
6.9.3 18 11/25/2024