Table of Contents

Class MySqlDatasourceConnection

Namespace
YndigoBlue.Velocity.Data.MySql
Assembly
YndigoBlue.Velocity.dll

Connection configuration for MySQL databases.

public class MySqlDatasourceConnection : DatasourceConnection, IDatasourceConnection
Inheritance
MySqlDatasourceConnection
Implements

Remarks

Default port: 3306

Includes geospatial support with distance calculations and SRID transformations.

SSL behaviour: Disable is not supported and will throw a NotSupportedException at connection time. MySQL 8.4+ uses caching_sha2_password by default, which requires either an SSL connection or RSA key exchange to protect credentials — neither of which is available when SSL is explicitly disabled. Use Prefer (the default) or higher.

Integrated security: UseIntegratedSecurity is supported for MySQL Enterprise Edition only. When set, Velocity omits the username and password and the server negotiates the authentication plugin automatically based on the user account's IDENTIFIED WITH configuration. MySQL Community Edition has no OS-level or Kerberos authentication; attempting to use integrated security against a Community server will result in a connection error.

Examples

// Connect to MySQL with standard configuration
var conn = new MySqlDatasourceConnection
{
    Hostname = "localhost",
    Port = 3306,
    Database = "mydatabase",
    Username = "root",
    Password = "mypassword"
};

using (var m = new Manager(conn))
{
    var schema = m.LoadSchema("mydatabase");
    // Perform database operations
}

Properties

AllowLoadLocalInfile

Gets or sets whether to allow LOAD DATA LOCAL INFILE statements for bulk data loading.

AllowUserVariables

Gets or sets whether to allow user-defined variables in SQL statements.

DatasourceType

Gets the datasource type for MySQL.

LengthUnit

Gets or sets the unit of measurement for distance calculations (e.g., "metre", "kilometer"). Default is "metre".