MySQL Connector/NET Developer Guide


This manual describes how to install and configure MySQL Connector/NET, the connector that enables .NET applications to communicate with MySQL servers, and how to use it to develop database applications.

For notes detailing the changes in each release of Connector/NET, see MySQL Connector/NET Release Notes.

For legal information, see the Legal Notices.

For help with using MySQL, please visit either the MySQL Forums or MySQL Mailing Lists, where you can discuss your issues with other MySQL users.

Licensing information.  This product may include third-party software, used under license. MySQL Connector/NET Community License Information User Manual has information about licenses relating to Connector/NET community releases up to and including version 7.0. MySQL Connector/NET Commercial License Information User Manual has information about licenses relating to Connector/NET commercial releases up to and including version 7.0. MySQL Connector/NET 8.0 Community License Information User Manual has information about licenses relating to Connector/NET community releases in the 8.0 release series. MySQL Connector/NET 8.0 Commercial License Information User Manual has information about licenses relating to Connector/NET commercial releases in the 8.0 release series.

Document generated on: 2018-12-19 (revision: 60427)

Table of Contents

Preface and Legal Notices
1 Introduction to MySQL Connector/NET
2 Connector/NET Versions
3 Connector/NET Installation
3.1 Installing Connector/NET on Windows
3.1.1 Installing Connector/NET Using MySQL Installer
3.1.2 Installing Connector/NET Using the Standalone Installer
3.1.3 Installing Connector/NET Using NuGet
3.2 Installing Connector/NET on Unix with Mono
3.3 Installing Connector/NET from the Source Code
4 Connector/NET Tutorials
4.1 Tutorial: An Introduction to Connector/NET Programming
4.1.1 The MySqlConnection Object
4.1.2 The MySqlCommand Object
4.1.3 Working with Decoupled Data
4.1.4 Working with Parameters
4.1.5 Working with Stored Procedures
4.2 Tutorial: Connector/NET ASP.NET Membership and Role Provider
4.3 Tutorial: Connector/NET ASP.NET Profile Provider
4.4 Tutorial: Web Parts Personalization Provider
4.5 Tutorial: Simple Membership Web Provider
4.6 Tutorial: Using an Entity Framework Entity as a Windows Forms Data Source
4.7 Tutorial: Data Binding in ASP.NET Using LINQ on Entities
4.8 Tutorial: Generating MySQL DDL from an Entity Framework Model
4.9 Tutorial: Basic CRUD Operations with Connector/NET
4.10 Tutorial: Using SSL with Connector/NET
4.11 Tutorial: Using MySqlScript
4.11.1 Using Delimiters with MySqlScript
5 Connector/NET Programming
5.1 Connecting to MySQL Using Connector/NET
5.1.1 Creating a Connector/NET Connection String
5.1.2 Handling Connection Errors
5.1.3 Using GetSchema on a Connection
5.2 Using MySqlCommand
5.3 Using Connector/NET with Connection Pooling
5.4 Using the Windows Native Authentication Plugin
5.5 Writing a Custom Authentication Plugin
5.6 Using Connector/NET with Table Caching
5.7 Using the Connector/NET with Prepared Statements
5.7.1 Preparing Statements in Connector/NET
5.8 Accessing Stored Procedures with Connector/NET
5.8.1 Using Stored Routines from Connector/NET
5.9 Handling BLOB Data With Connector/NET
5.9.1 Preparing the MySQL Server
5.9.2 Writing a File to the Database
5.9.3 Reading a BLOB from the Database to a File on Disk
5.10 Asynchronous Methods
5.11 Using the Connector/NET Interceptor Classes
5.12 Handling Date and Time Information in Connector/NET
5.12.1 Fractional Seconds
5.12.2 Problems when Using Invalid Dates
5.12.3 Restricting Invalid Dates
5.12.4 Handling Invalid Dates
5.12.5 Handling NULL Dates
5.13 Using the MySqlBulkLoader Class
5.14 Using the Connector/NET Trace Source Object
5.14.1 Viewing MySQL Trace Information
5.14.2 Building Custom Listeners
5.15 Binary/Nonbinary Issues
5.16 Character Set Considerations for Connector/NET
5.17 Using Connector/NET with Crystal Reports
5.17.1 Creating a Data Source
5.17.2 Creating the Report
5.17.3 Displaying the Report
5.18 ASP.NET Provider Model
5.19 Working with Partial Trust / Medium Trust
5.19.1 Evolution of Partial Trust Support Across Connector/NET Versions
5.19.2 Configuring Partial Trust with Connector/NET Library Installed in GAC
5.19.3 Configuring Partial Trust with Connector/NET Library Not Installed in GAC
6 Connector/NET 6.10 Connection-String Options Reference
7 Connector/NET 8.0 Connection Options Reference
8 Connector/NET for Windows Store
9 Connector/NET for Entity Framework
9.1 Entity Framework 6 Support
9.2 Entity Framework Core Support
9.2.1 Creating a Database with Code First in EF Core
9.2.2 Scaffolding an Existing Database in EF Core
9.2.3 Configuring Character Sets and Collations in EF Core
10 Connector/NET API Reference
10.1 Microsoft.EntityFrameworkCore Namespace
10.2 MySql.Data.Entity Namespace
10.3 MySql.Data.EntityFrameworkCore Namespace
10.4 MySql.Data.MySqlClient Namespace
10.5 MySql.Data.MySqlClient.Authentication Namespace
10.6 MySql.Data.MySqlClient.Interceptors Namespace
10.7 MySql.Data.MySqlClient.Memcached Namespace
10.8 MySql.Data.MySqlClient.Replication Namespace
10.9 MySql.Data.Types Namespace
10.10 MySql.Web Namespace
11 Connector/NET Support
11.1 Connector/NET Community Support
11.2 How to Report Connector/NET Problems or Bugs
12 Connector/NET FAQ