MySQL and Windows  /  ...  /  Connect Using MySQL Connections Manager

6.4.2 Connect Using MySQL Connections Manager

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, start MySQL Connections Manager and select an existing connection. You can modify any of the settings by overwriting the existing values with new ones. Note that the connection may be modified or deleted only if no active editor for its objects is opened; otherwise, you may lose your data.

Basic Connections with MySQL Connections Manager

To create a connection to an existing MySQL database:

  1. Click MySQL Connections Manager icon in the Server Explorer menu bar to open the MySQL Connections Manager window.

  2. Click Add New Connection to create a new connection.

  3. Provide a unique name for the new connection in the required Connection Name field.

  4. Confirm that TCP/IP (standard) is selected as the connection method.

  5. In the Parameters tab, add or modify the following information:

    • Hostname: and Port:

      The name (or IP address) and port number of the computer hosting the MySQL server. For example, localhost if the MySQL server is installed on the local computer. The default port value is 3306.

    • Username:

      The name of a valid MySQL user account.

    • Password:

      The password of the user account specified previously.

    • Default Schema:

      A default schema name is required to open the connection. Select a name from the list.

  6. Click Test Connection to verify the connection information.

  7. Click OK to create and store the new connection. The new connection now appears in MySQL Connections Manager. Optionally, select the new connection from Connections Manager to add its tables, views, stored procedures, stored functions, and UDFs to the Data Connections node in Server Explorer.

SSL Connections with Connections Manager

X Protocol connections can be configured to use SSL with PEM or PFX files. Connections must be created using the MySQL Connections Manager, which is supported by MySQL for Visual Studio 2.0.5 (or higher). MySQL Workbench provides similar support to add PEM files, but it does not support certificates in PFX format.

Note

X Plugin must be installed to support connections using X Protocol (see Setting Up MySQL as a Document Store ).

In contrast, classic MySQL protocol connections support SSL PFX files only when you use MySQL Connections Manager to configure the connection.

To create a connection to a MySQL database using SSL encryption:

  1. Click MySQL Connections Manager icon in the Server Explorer menu bar to open the MySQL Connections Manager window.

  2. Add and test a new basic connection (see Basic Connections with MySQL Connections Manager) or double-click an existing connection to modify it.

  3. In the SSL tab, add a path to the SSL CA, SSL CERT, and SSL Key files within the SSL PEM area. Click Test Connection to verify the connection information. The next figure shows an example of SSL PEM values within this tab.

    Figure 6.12 MySQL Server Connection SSL Tab

    SSL PEM options and example values. SSL CA File: C:\certs\ca-cert.pem, SSL CERT File: C:\certs\server-cert.pem, SSL Key File: C:\certs\server-key.pem.

    To configure SSL PFX (PKCS#12 format), select either the file-based or store-based option. Use the .pfx file extension to enable the correct certificate format.

  4. Click OK to save the connection and return to the MySQL Connections Manager window.

    Note

    You must close and then reopen MySQL Connections Manager to apply the default schema.

  5. Double-click the new SSL connection to add it to Server Explorer (or select the connection and click OK). To open the JavaScript or Python code editor, right-click the connection in Server Explorer and then select an editor.