This section describes how to create a new connection with or without encryption. After a connection is successfully established, all settings are saved for future use. When you start Visual Studio for the next time, open the connection node in Server Explorer to establish a connection to the MySQL server again. The instructions for setting up connections are provided in these sections.
To modify or delete a connection, use the Server Explorer context menu for the corresponding node. You can modify any of the settings by overwriting the existing values with new ones. The connection may be modified or deleted only if no active editor for its objects is opened; otherwise, you may lose your data.
To create a connection to an existing MySQL database:
Start Visual Studio and open the Server Explorer by clicking
from the menu.Right-click the Data Connections node and then select
.From the Add Connection window, click
to open the Change Data Source dialog box, then do the following:Select
MySQL Database
from the list of data sources. Alternatively, you can select<other>
, ifMySQL Database
is absent.Select
.NET Framework Data Provider for MySQL
as the data provider.Click
to return to the Add Connections window.
Type a value for each of the following connection settings:
Server name:
The name or IP address of the computer hosting the MySQL server. For example,
localhost
if the MySQL server is installed on the local computer.User name:
The name of a valid MySQL database user account.
Password:
The password of the user account specified previously. Optionally, click Save my password to avoid having to enter the password in the Modify Connections window for each connection session.
Database name:
The database to use as the default schema. You can leave the name blank and select a default schema later from the list of schema on the target server.
You can also set the port to connect with the MySQL server by clicking
. To test connection with the MySQL server, set the server host name, the user name and the password, and then click . If the test succeeds, the success confirmation dialog box opens.Click Data Connections node of Server Explorer.
to create and store the new connection. The new connection with its tables, views, stored procedures, stored functions, and loadable functions now appears within the
You can enable SSL encryption for a classic MySQL protocol connection from Server Explorer. Both SSL PEM and PFX certificate formats are permitted. In addition, MySQL Connector/NET version 8.0.17 must be installed on the client host.
To create a connection with SSL encryption enabled:
Add and test a new basic connection (see Basic Connections with Server Explorer.
To modify an existing connection, right-click the connection node within Data Connections and select .
In the Add (or Modify) Connection window, click
to open the Advanced Properties dialog box. Advanced properties are categorized and presented in a two-column list, showing the property name and value field (or value list). Default values are not shown.In the Connection property category, do the following:
Select Connection Protocol and then select
Socket
from the value list (use the arrow in the value field to open the list). This property sets the connection protocol to use standard TCP/IP.Select Port and type
3306
in the value field.
In the Authentication property category, select
Ssl Mode
and choose the type of mode that best represents your connection. For a description of each mode and the required files, see Table 5.2, “SSL Mode Values”.For SSL PEM, use the Ssl CA, Ssl Cert, and Ssl Key properties to add the required files (must have a
.pem
file extension).For SSL PFX (PKCS#12 format), use the Certificate File, Certificate Password, Certificate Store Location, and Certificate Thumbprint properties to add the required information or files (must have a
.pfx
file extension).
Click
to close the Advanced Properties dialog box.Click
and adjust the property values if needed.Click
to create and store the new or modified connection.