MySQL for Visual Studio leverages and extends the connection capabilities of Visual Studio to create and store MySQL connections. To ensure access to the full set of connection options, install the most recent version of MySQL Connector/NET on the client computer (see Minimum Requirements).
MySQL for Visual Studio provides the following two distinct release series:
MySQL for Visual Studio 1.2 release series. Provides General Availability (GA) releases for use with MySQL 5.6, 5.7, and 8.0 servers. Connections can be made to MySQL using the classic protocol only (3306 default port number). When the server supports SSL connections, PEM and PFX certificates are permitted with Connector/NET 8.0.16 or higher. Standard TCP/IP over SSH connections are also supported and require MySQL Connector/NET 8.0.17 or higher. Unencrypted connections are supported with most versions of MySQL Connector/NET. To add or modify MySQL data connections, use Server Explorer in Visual Studio (see Section 6.4.1, “Connect Using Server Explorer”).
MySQL for Visual Studio 2.0 release series. Provides a development release series for use with MySQL 5.6 and 5.7 servers (version 2.0.5 is the current milestone). Basic connections are supported for both the classic MySQL protocol and X Protocol (33060 default port number). When the server supports SSL connections, PEM and PFX certificates are permitted with X Protocol; PFX certificates are permitted with the classic MySQL protocol. Use either MySQL Connections Manager or Server Explorer in Visual Studio to add or modify classic MySQL protocol connections. To add or modify X Protocol connections, use MySQL Connections Manager only (see Section 6.4.2, “Connect Using MySQL Connections Manager”).
MySQL Connections Manager was introduced in the MySQL for Visual Studio 2.0 release series to simplify the creation and management of MySQL server connections within Visual Studio. From MySQL Connections Manager, you have the option to migrate all stored connections to MySQL Workbench (if it is installed), making MySQL Workbench a central repository for MySQL connections.
A basic connection is either unencrypted or encrypted (in MySQL 8.0, SSL is enabled by default) and the connection is made using standard TPC/IP, which is the default connection method in MySQL for Visual Studio to connect to the MySQL RDBMS. Basic connections are easy to configure, particularly if the client application and MySQL server are on the same host computer or operate within the same local area network. For instructions on how to create a basic connection to MySQL from within Visual Studio, see Basic Connections with Server Explorer or Basic Connections with MySQL Connections Manager.
MySQL Server uses the PEM format for certificates and private keys. Connector/NET 8.0.17 enables the use of either PEM or PFX certificates with the classic MySQL protocol when Server Explorer in Visual Studio (with MySQL for Visual Studio 1.2.9 or higher) is used to add or modify the data connection.
Both the MySQL server and the client must be configured to enable SSL encryption (see Using Encrypted Connections). In addition to providing the paths to certificate files, the client can specify the SSL mode to use for connections. When using Server Explorer, the SSL mode value is set with an advanced property. MySQL Connections Manager provides the Use SSL Encryption drop-down list with similar values. The following table describes the optional SSL values to select (and the files to specify) with each tool.
Table 6.2 SSL Mode Values
|Server Explorer||Connections Manager||Description|
|Do not use SSL. No SSL files are required.|
|Use SSL if the server supports it, but allow connection in all cases.
|Always use SSL and deny a connection if the server does not support SSL. Do not perform server certificate validation. No SSL files are required.|
|Always use SSL. Validate the certificate authorities (CA), but tolerate
a name mismatch. Requires the SSL CA file. Use either a
|Always use SSL and fail if the host name is not correct. Requires valid
SSL CA, SSL Cert, and SSL Key files for PEM
SSH tunneling (or port forwarding) enables you to create a secure connection between your computer and a remote computer through which you can access MySQL data. SSH tunnels permit you to connect to a MySQL database from behind a firewall when the MySQL server port is blocked.
There are several considerations for connecting with standard TCP/IP over SSH:
Your application (or the user account making the connection) requires authorization on the SSH server.
The SSH server communicates with a MySQL server instance in an unencrypted or encrypted mode, based on the value selected for the SSL mode (see Table 6.2, “SSL Mode Values”). The MySQL server instance does not require additional configuration for this type of connection.
Connection Protocolproperty must use the default value (
socket) to establish a connection over standard TCP/IP when configured with Server Explorer.
To authenticate the client requesting a connection (specified by
SSH User Name), you can use one of the following strategies:
SSH User Nameand
SSH User Nameand
SSH Key Fileonly
Your SSH server may require that you to also provide the
SSH Passphraseproperty when using a key file. An invalid pass phrase generates an exception.
SSH User Nameand
SSH Key File(
SSH Passphrase) and
The combination of user name + key file (passphrase) + password can perform fallback authentication when the key file and pass phrase are valid, but an error occurs on the server. Specifically, the first attempt to connect uses the key file, and if it fails, the next attempt to connect uses the password instead. If the SSH key file is null or empty, but the SSH password is provided, MySQL for Visual Studio attempts to connect using the SSH password only.