Migrating from Connector/NET
Connection String Differences
MySqlConnector has some different default connection string options:
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.
|MySqlConnector always resets pooled connections by default so that the connection is in a known state. This fixes MySQL Bug 77421.
|(not configurable, effective default is
|Connector/NET currently has a bug that prevents multiple host names being used.
||Specify a file containing the server's RSA public key to allow
sha256_password authentication over an insecure connection.
|This also affects the behavior of the
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
while Connector/NET uses regular database transactions. As a result, code that uses
may execute differently with MySqlConnector. To get Connector/NET-compatible behavior, remove
TransactionScope and use
Connector/NET allows a
MySqlConnection object to be reused after it has been disposed. MySqlConnector requires a new
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
MySqlTransaction. MySqlConnector will throw an
InvalidOperationException if the
property doesn’t reference the active transaction. See #333 for more details.
For consistency with other ADO.NET providers, MySqlConnector will throw
InvalidOperationException (instead of
for various precondition checks that indicate misuse of the API (and not a problem related to MySQL Server).
Bugs present in Connector/NET that are fixed in MySqlConnector
- #37283, #70587: Distributed transactions are not supported
- #50773: Can’t use multiple connections within one TransactionScope
ColumnOrdinal in schema table is 1-based
- #66476: Connection pool uses queue instead of stack
Async methods execute synchronously
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
- #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:
TINYINT(1) values start being returned as
- #80030: Slow to connect with pooling disabled
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 paramter using a 64-bit enum with a value greater than int.MaxValue
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
ColumnSize in schema table is incorrect for
IsLong is schema table is incorrect for
decimal(n, 0) has wrong
- #88124: CommandTimeout isn’t reset when calling Read/NextResult