Migrating from Connector/NET

Connection String Differences

MySqlConnector has some different default connection string options:

Option MySqlConnector Oracle’s Connector/NET Notes
AllowPublicKeyRetrieval Default is false (not configurable) When using sha256_password authentication, this option allows the RSA public key to be retrieved from the server (when not using a secure connection). It’s false by default to avoid disclosing the password to a malicious proxy.
ConnectionReset Default is true Default is false MySqlConnector always resets pooled connections by default so that the connection is in a known state. This fixes MySQL Bug 77421.
IgnoreCommandTransaction Default is false (not configurable, effective default is true) See remarks under MySqlCommand below.
LoadBalance Default is RoundRobin (not configurable, effective default is FailOver) Connector/NET currently has a bug that prevents multiple host names being used.
ServerRSAPublicKeyFile (no default) (not configurable) Specify a file containing the server’s RSA public key to allow sha256_password authentication over an insecure connection.
UseAffectedRows Default is true Default is false This also affects the behavior of the ROW_COUNT function. UseAffectedRows=true is the default in most other languages (C++, PHP, others)

Some connection string options that are supported in Connector/NET are not supported in MySqlConnector. For a full list of options that are supported in MySqlConnector, see the Connection Options.


MySqlConnector adds full distributed transaction support (for client code using TransactionScope), while Connector/NET uses regular database transactions. As a result, code that uses TransactionScope may execute differently with MySqlConnector. To get Connector/NET-compatible behavior, remove TransactionScope and use BeginTransaction/Commit directly.


Connector/NET allows a MySqlConnection object to be reused after it has been disposed. MySqlConnector requires a new MySqlConnection object to be created. See #331 for more details.


Connector/NET allows a command to be executed even when MySqlCommand.Transaction references a commited, rolled back, or disposed MySqlTransaction. MySqlConnector will throw an InvalidOperationException if the MySqlCommand.Transaction property doesn’t reference the active transaction. This fixes MySQL Bug 88611. To disable this strict validation, set IgnoreCommandTransaction=true in the connection string. See Issue 474 for more details.


For consistency with other ADO.NET providers, MySqlConnector will throw InvalidOperationException (instead of MySqlException) for various precondition checks that indicate misuse of the API (and not a problem related to MySQL Server).

Fixed Bugs

The following bugs in Connector/NET are fixed by switching to MySqlConnector. (Strikethrough indicates bugs that have since been fixed in a newer version of Connector/NET, but were fixed first in MySqlConnector.)

  • #37283, #70587: Distributed transactions are not supported
  • #50773: Can’t use multiple connections within one TransactionScope
  • #61477: ColumnOrdinal in schema table is 1-based
  • #66476: Connection pool uses queue instead of stack
  • #70111: Async methods execute synchronously
  • #70686: TIME(3) and TIME(6) fields serialize milliseconds incorrectly
  • #72494, #83330: EndOfStreamException inserting large blob with UseCompression=True
  • #73610: Invalid password exception has wrong number
  • #73788: Can’t use DateTimeOffset
  • #75604: Crash after 29.4 days of uptime
  • #75917, #76597, #77691, #78650, #78919, #80921, #82136: “Reading from the stream has failed” when connecting to a server
  • #77421: Connection is not reset when pulled from the connection pool
  • #78426: Unknown database exception has wrong number
  • #78760: Error when using tabs and newlines in SQL statements
  • #78917, #79196, #82292, #89040: TINYINT(1) values start being returned as sbyte after NULL
  • #80030: Slow to connect with pooling disabled
  • #81650, #88962: Server connection string option may now contain multiple, comma separated hosts that will be tried in order until a connection succeeds
  • #83229: “Unknown command” exception inserting large blob with UseCompression=True
  • #84220: Cannot call a stored procedure with . in its name
  • #84701: Can’t create a parameter using a 64-bit enum with a value greater than int.MaxValue
  • #85185: ConnectionReset=True does not preserve connection charset
  • #86263: Transaction isolation level affects all transactions in session
  • #87307: NextResult hangs instead of timing out
  • #87316: MySqlCommand.CommandTimeout can be set to a negative value
  • #87868: ColumnSize in schema table is incorrect for CHAR(36) and BLOB columns
  • #87876: IsLong is schema table is incorrect for LONGTEXT and LONGBLOB columns
  • #88058: decimal(n, 0) has wrong NumericPrecision
  • #88124: CommandTimeout isn’t reset when calling Read/NextResult
  • #88472: TINYINT(1) is not returned as bool if MySqlCommand.Prepare is called
  • #88611: MySqlCommand can be executed even if it has “wrong” transaction
  • #88660: MySqlClientFactory.Instance.CreateDataAdapter() and CreateCommandBuilder return null
  • #89085: MySqlConnection.Database not updated after USE database;
  • #89159: MySqlDataReader cannot outlive MySqlCommand
  • #89335: MySqlCommandBuilder.DeriveParameters fails for JSON type
  • #89639: ReservedWords schema contains incorrect data
  • #91123: Database names are case-sensitive when calling a stored procedure
  • #91199: Can’t insert MySqlDateTime values
  • #91751: YEAR column retrieved incorrectly with prepared command
  • #91752: 00:00:00 is converted to NULL with prepared command
  • #91753: Unnamed parameter not supported by MySqlCommand.Prepare
  • #91754: Inserting 16MiB BLOB shifts it by four bytes when prepared
  • #91770: TIME(n) column loses microseconds with prepared command
  • #92367: MySqlDataReader.GetDateTime and GetValue return inconsistent values
  • #92734: MySqlParameter.Clone doesn’t copy all property values
  • #92789: Illegal connection attributes written for non-ASCII values
  • #92912: MySqlDbType.LongText values encoded incorrectly with prepared statements
  • #92982: FormatException thrown when connecting to MySQL Server 8.0.13
  • #93047: MySqlDataAdapter throws timeout exception when an error occurs